From 8733092a39b151acc03788a5b72e8adfbc29bb63 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 9 Feb 2026 16:21:51 +0300 Subject: [PATCH 1/2] Codegen: Communication Preferences --- .../{DefinitionApi.php => DefinitionsApi.php} | 169 ++++---- .../Api/StatusApi.php | 369 ++++++------------ .../CommunicationPreferences/ApiException.php | 6 +- .../Configuration.php | 65 ++- .../FormDataProcessor.php | 246 ++++++++++++ .../HeaderSelector.php | 6 +- .../CommunicationPreferences/Model/Error.php | 160 ++++---- .../Model/ErrorDetail.php | 136 +++---- .../Model/ModelInterface.php | 6 +- .../Model/PublicSubscriptionStatus.php | 298 +++++++------- .../PublicSubscriptionStatusesResponse.php | 18 +- .../PublicUpdateSubscriptionStatusRequest.php | 100 ++--- .../Model/SubscriptionDefinition.php | 320 +++++++-------- .../Model/SubscriptionDefinitionsResponse.php | 18 +- .../ObjectSerializer.php | 26 +- 15 files changed, 1046 insertions(+), 897 deletions(-) rename codegen/CommunicationPreferences/Api/{DefinitionApi.php => DefinitionsApi.php} (75%) create mode 100644 codegen/CommunicationPreferences/FormDataProcessor.php diff --git a/codegen/CommunicationPreferences/Api/DefinitionApi.php b/codegen/CommunicationPreferences/Api/DefinitionsApi.php similarity index 75% rename from codegen/CommunicationPreferences/Api/DefinitionApi.php rename to codegen/CommunicationPreferences/Api/DefinitionsApi.php index d55dda40..412f1c13 100644 --- a/codegen/CommunicationPreferences/Api/DefinitionApi.php +++ b/codegen/CommunicationPreferences/Api/DefinitionsApi.php @@ -1,7 +1,7 @@ getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -247,34 +210,11 @@ public function getPageWithHttpInfo(string $contentType = self::contentTypes['ge ); } - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse'; - if ($returnType === '\SplFileObject') { - $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() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\SubscriptionDefinitionsResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -284,7 +224,7 @@ public function getPageWithHttpInfo(string $contentType = self::contentTypes['ge $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -292,8 +232,10 @@ public function getPageWithHttpInfo(string $contentType = self::contentTypes['ge $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -465,6 +407,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/CommunicationPreferences/Api/StatusApi.php b/codegen/CommunicationPreferences/Api/StatusApi.php index 9a708ca3..cd67ca6c 100644 --- a/codegen/CommunicationPreferences/Api/StatusApi.php +++ b/codegen/CommunicationPreferences/Api/StatusApi.php @@ -1,7 +1,7 @@ getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -255,34 +218,11 @@ public function getEmailStatusWithHttpInfo($email_address, string $contentType = ); } - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse'; - if ($returnType === '\SplFileObject') { - $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() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatusesResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -292,7 +232,7 @@ public function getEmailStatusWithHttpInfo($email_address, string $contentType = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -300,8 +240,10 @@ public function getEmailStatusWithHttpInfo($email_address, string $contentType = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -534,61 +476,21 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request switch($statusCode) { case 200: - if ('\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', + $request, + $response, + ); default: - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -602,34 +504,11 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request ); } - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; - if ($returnType === '\SplFileObject') { - $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() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -639,7 +518,7 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -647,8 +526,10 @@ public function subscribeWithHttpInfo($public_update_subscription_status_request $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -880,61 +761,21 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque switch($statusCode) { case 200: - if ('\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', + $request, + $response, + ); default: - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\CommunicationPreferences\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\CommunicationPreferences\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -948,34 +789,11 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque ); } - $returnType = '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus'; - if ($returnType === '\SplFileObject') { - $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() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\CommunicationPreferences\Model\PublicSubscriptionStatus', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -985,7 +803,7 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -993,8 +811,10 @@ public function unsubscribeWithHttpInfo($public_update_subscription_status_reque $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1183,6 +1003,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $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() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/CommunicationPreferences/ApiException.php b/codegen/CommunicationPreferences/ApiException.php index 55d2bcee..eeaa84a3 100644 --- a/codegen/CommunicationPreferences/ApiException.php +++ b/codegen/CommunicationPreferences/ApiException.php @@ -1,7 +1,7 @@ tempFolderPath; } + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + /** * Gets the default configuration instance * diff --git a/codegen/CommunicationPreferences/FormDataProcessor.php b/codegen/CommunicationPreferences/FormDataProcessor.php new file mode 100644 index 00000000..a9e1e4a1 --- /dev/null +++ b/codegen/CommunicationPreferences/FormDataProcessor.php @@ -0,0 +1,246 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/codegen/CommunicationPreferences/HeaderSelector.php b/codegen/CommunicationPreferences/HeaderSelector.php index 8a3caaa4..ad739da8 100644 --- a/codegen/CommunicationPreferences/HeaderSelector.php +++ b/codegen/CommunicationPreferences/HeaderSelector.php @@ -1,7 +1,7 @@ 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]' + 'sub_category' => 'string' ]; /** @@ -74,13 +74,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, 'correlation_id' => 'uuid', + 'errors' => null, 'links' => null, 'message' => null, - 'category' => null, - 'errors' => null + 'sub_category' => null ]; /** @@ -89,13 +89,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, 'correlation_id' => false, + 'errors' => false, 'links' => false, 'message' => false, - 'category' => false, - 'errors' => false + 'sub_category' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', 'correlation_id' => 'correlationId', + 'errors' => 'errors', 'links' => 'links', 'message' => 'message', - 'category' => 'category', - 'errors' => 'errors' + 'sub_category' => 'subCategory' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', 'correlation_id' => 'setCorrelationId', + 'errors' => 'setErrors', 'links' => 'setLinks', 'message' => 'setMessage', - 'category' => 'setCategory', - 'errors' => 'setErrors' + 'sub_category' => 'setSubCategory' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', 'correlation_id' => 'getCorrelationId', + 'errors' => 'getErrors', 'links' => 'getLinks', 'message' => 'getMessage', - 'category' => 'getCategory', - 'errors' => 'getErrors' + 'sub_category' => 'getSubCategory' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -316,15 +316,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['correlation_id'] === null) { $invalidProperties[] = "'correlation_id' can't be null"; } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } return $invalidProperties; } @@ -341,28 +341,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return string|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string $category The error category * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -421,6 +421,33 @@ public function setCorrelationId($correlation_id) return $this; } + /** + * Gets errors + * + * @return \HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** * Gets links * @@ -476,66 +503,39 @@ public function setMessage($message) } /** - * Gets category - * - * @return string - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string $category The error category - * - * @return self - */ - public function setCategory($category) - { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); - } - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets errors + * Gets sub_category * - * @return \HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]|null + * @return string|null */ - public function getErrors() + public function getSubCategory() { - return $this->container['errors']; + return $this->container['sub_category']; } /** - * Sets errors + * Sets sub_category * - * @param \HubSpot\Client\CommunicationPreferences\Model\ErrorDetail[]|null $errors further information about the error + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setErrors($errors) + public function setSubCategory($sub_category) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['errors'] = $errors; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -543,12 +543,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -573,11 +573,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/ErrorDetail.php b/codegen/CommunicationPreferences/Model/ErrorDetail.php index de4b450e..e239b7ba 100644 --- a/codegen/CommunicationPreferences/Model/ErrorDetail.php +++ b/codegen/CommunicationPreferences/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,11 +57,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', 'code' => 'string', - 'in' => 'string', 'context' => 'array', - 'message' => 'string' + 'in' => 'string', + 'message' => 'string', + 'sub_category' => 'string' ]; /** @@ -72,11 +72,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, 'code' => null, - 'in' => null, 'context' => null, - 'message' => null + 'in' => null, + 'message' => null, + 'sub_category' => null ]; /** @@ -85,11 +85,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, 'code' => false, - 'in' => false, 'context' => false, - 'message' => false + 'in' => false, + 'message' => false, + 'sub_category' => false ]; /** @@ -178,11 +178,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', 'code' => 'code', - 'in' => 'in', 'context' => 'context', - 'message' => 'message' + 'in' => 'in', + 'message' => 'message', + 'sub_category' => 'subCategory' ]; /** @@ -191,11 +191,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', 'code' => 'setCode', - 'in' => 'setIn', 'context' => 'setContext', - 'message' => 'setMessage' + 'in' => 'setIn', + 'message' => 'setMessage', + 'sub_category' => 'setSubCategory' ]; /** @@ -204,11 +204,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', 'code' => 'getCode', - 'in' => 'getIn', 'context' => 'getContext', - 'message' => 'getMessage' + 'in' => 'getIn', + 'message' => 'getMessage', + 'sub_category' => 'getSubCategory' ]; /** @@ -268,11 +268,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -321,55 +321,55 @@ public function valid() /** - * Gets sub_category + * Gets code * * @return string|null */ - public function getSubCategory() + public function getCode() { - return $this->container['sub_category']; + return $this->container['code']; } /** - * Sets sub_category + * Sets code * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $code The status code associated with the error detail * * @return self */ - public function setSubCategory($sub_category) + public function setCode($code) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['code'] = $code; return $this; } /** - * Gets code + * Gets context * - * @return string|null + * @return array|null */ - public function getCode() + public function getContext() { - return $this->container['code']; + return $this->container['context']; } /** - * Sets code + * Sets context * - * @param string|null $code The status code associated with the error detail + * @param array|null $context Context about the error condition * * @return self */ - public function setCode($code) + public function setContext($context) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); } - $this->container['code'] = $code; + $this->container['context'] = $context; return $this; } @@ -402,66 +402,66 @@ public function setIn($in) } /** - * Gets context + * Gets message * - * @return array|null + * @return string */ - public function getContext() + public function getMessage() { - return $this->container['context']; + return $this->container['message']; } /** - * Sets context + * Sets message * - * @param array|null $context Context about the error condition + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setContext($context) + public function setMessage($message) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['context'] = $context; + $this->container['message'] = $message; return $this; } /** - * Gets message + * Gets sub_category * - * @return string + * @return string|null */ - public function getMessage() + public function getSubCategory() { - return $this->container['message']; + return $this->container['sub_category']; } /** - * Sets message + * Sets sub_category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setMessage($message) + public function setSubCategory($sub_category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['message'] = $message; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -469,12 +469,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -499,11 +499,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/ModelInterface.php b/codegen/CommunicationPreferences/Model/ModelInterface.php index c80bc030..a3906a0b 100644 --- a/codegen/CommunicationPreferences/Model/ModelInterface.php +++ b/codegen/CommunicationPreferences/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences\Model @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** diff --git a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php index 59531246..9005f0ea 100644 --- a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php +++ b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatus.php @@ -2,7 +2,7 @@ /** * PublicSubscriptionStatus * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,14 +58,14 @@ class PublicSubscriptionStatus implements ModelInterface, ArrayAccess, \JsonSeri */ protected static $openAPITypes = [ 'brand_id' => 'int', - 'name' => 'string', 'description' => 'string', - 'legal_basis' => 'string', - 'preference_group_name' => 'string', 'id' => 'string', + 'legal_basis' => 'string', 'legal_basis_explanation' => 'string', - 'status' => 'string', - 'source_of_status' => 'string' + 'name' => 'string', + 'preference_group_name' => 'string', + 'source_of_status' => 'string', + 'status' => 'string' ]; /** @@ -77,14 +77,14 @@ class PublicSubscriptionStatus implements ModelInterface, ArrayAccess, \JsonSeri */ protected static $openAPIFormats = [ 'brand_id' => 'int64', - 'name' => null, 'description' => null, - 'legal_basis' => null, - 'preference_group_name' => null, 'id' => null, + 'legal_basis' => null, 'legal_basis_explanation' => null, - 'status' => null, - 'source_of_status' => null + 'name' => null, + 'preference_group_name' => null, + 'source_of_status' => null, + 'status' => null ]; /** @@ -94,14 +94,14 @@ class PublicSubscriptionStatus implements ModelInterface, ArrayAccess, \JsonSeri */ protected static array $openAPINullables = [ 'brand_id' => false, - 'name' => false, 'description' => false, - 'legal_basis' => false, - 'preference_group_name' => false, 'id' => false, + 'legal_basis' => false, 'legal_basis_explanation' => false, - 'status' => false, - 'source_of_status' => false + 'name' => false, + 'preference_group_name' => false, + 'source_of_status' => false, + 'status' => false ]; /** @@ -191,14 +191,14 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'brand_id' => 'brandId', - 'name' => 'name', 'description' => 'description', - 'legal_basis' => 'legalBasis', - 'preference_group_name' => 'preferenceGroupName', 'id' => 'id', + 'legal_basis' => 'legalBasis', 'legal_basis_explanation' => 'legalBasisExplanation', - 'status' => 'status', - 'source_of_status' => 'sourceOfStatus' + 'name' => 'name', + 'preference_group_name' => 'preferenceGroupName', + 'source_of_status' => 'sourceOfStatus', + 'status' => 'status' ]; /** @@ -208,14 +208,14 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'brand_id' => 'setBrandId', - 'name' => 'setName', 'description' => 'setDescription', - 'legal_basis' => 'setLegalBasis', - 'preference_group_name' => 'setPreferenceGroupName', 'id' => 'setId', + 'legal_basis' => 'setLegalBasis', 'legal_basis_explanation' => 'setLegalBasisExplanation', - 'status' => 'setStatus', - 'source_of_status' => 'setSourceOfStatus' + 'name' => 'setName', + 'preference_group_name' => 'setPreferenceGroupName', + 'source_of_status' => 'setSourceOfStatus', + 'status' => 'setStatus' ]; /** @@ -225,14 +225,14 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'brand_id' => 'getBrandId', - 'name' => 'getName', 'description' => 'getDescription', - 'legal_basis' => 'getLegalBasis', - 'preference_group_name' => 'getPreferenceGroupName', 'id' => 'getId', + 'legal_basis' => 'getLegalBasis', 'legal_basis_explanation' => 'getLegalBasisExplanation', - 'status' => 'getStatus', - 'source_of_status' => 'getSourceOfStatus' + 'name' => 'getName', + 'preference_group_name' => 'getPreferenceGroupName', + 'source_of_status' => 'getSourceOfStatus', + 'status' => 'getStatus' ]; /** @@ -276,18 +276,18 @@ public function getModelName() return self::$openAPIModelName; } - public const LEGAL_BASIS_LEGITIMATE_INTEREST_PQL = 'LEGITIMATE_INTEREST_PQL'; - public const LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT = 'LEGITIMATE_INTEREST_CLIENT'; - public const LEGAL_BASIS_PERFORMANCE_OF_CONTRACT = 'PERFORMANCE_OF_CONTRACT'; public const LEGAL_BASIS_CONSENT_WITH_NOTICE = 'CONSENT_WITH_NOTICE'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT = 'LEGITIMATE_INTEREST_CLIENT'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER = 'LEGITIMATE_INTEREST_OTHER'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_PQL = 'LEGITIMATE_INTEREST_PQL'; public const LEGAL_BASIS_NON_GDPR = 'NON_GDPR'; + public const LEGAL_BASIS_PERFORMANCE_OF_CONTRACT = 'PERFORMANCE_OF_CONTRACT'; public const LEGAL_BASIS_PROCESS_AND_STORE = 'PROCESS_AND_STORE'; - public const LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER = 'LEGITIMATE_INTEREST_OTHER'; - public const STATUS_SUBSCRIBED = 'SUBSCRIBED'; - public const STATUS_NOT_SUBSCRIBED = 'NOT_SUBSCRIBED'; - public const SOURCE_OF_STATUS_PORTAL_WIDE_STATUS = 'PORTAL_WIDE_STATUS'; public const SOURCE_OF_STATUS_BRAND_WIDE_STATUS = 'BRAND_WIDE_STATUS'; + public const SOURCE_OF_STATUS_PORTAL_WIDE_STATUS = 'PORTAL_WIDE_STATUS'; public const SOURCE_OF_STATUS_SUBSCRIPTION_STATUS = 'SUBSCRIPTION_STATUS'; + public const STATUS_NOT_SUBSCRIBED = 'NOT_SUBSCRIBED'; + public const STATUS_SUBSCRIBED = 'SUBSCRIBED'; /** * Gets allowable values of the enum @@ -297,13 +297,13 @@ public function getModelName() public function getLegalBasisAllowableValues() { return [ - self::LEGAL_BASIS_LEGITIMATE_INTEREST_PQL, - self::LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT, - self::LEGAL_BASIS_PERFORMANCE_OF_CONTRACT, self::LEGAL_BASIS_CONSENT_WITH_NOTICE, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_PQL, self::LEGAL_BASIS_NON_GDPR, + self::LEGAL_BASIS_PERFORMANCE_OF_CONTRACT, self::LEGAL_BASIS_PROCESS_AND_STORE, - self::LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER, ]; } @@ -312,11 +312,12 @@ public function getLegalBasisAllowableValues() * * @return string[] */ - public function getStatusAllowableValues() + public function getSourceOfStatusAllowableValues() { return [ - self::STATUS_SUBSCRIBED, - self::STATUS_NOT_SUBSCRIBED, + self::SOURCE_OF_STATUS_BRAND_WIDE_STATUS, + self::SOURCE_OF_STATUS_PORTAL_WIDE_STATUS, + self::SOURCE_OF_STATUS_SUBSCRIPTION_STATUS, ]; } @@ -325,12 +326,11 @@ public function getStatusAllowableValues() * * @return string[] */ - public function getSourceOfStatusAllowableValues() + public function getStatusAllowableValues() { return [ - self::SOURCE_OF_STATUS_PORTAL_WIDE_STATUS, - self::SOURCE_OF_STATUS_BRAND_WIDE_STATUS, - self::SOURCE_OF_STATUS_SUBSCRIPTION_STATUS, + self::STATUS_NOT_SUBSCRIBED, + self::STATUS_SUBSCRIBED, ]; } @@ -350,14 +350,14 @@ public function getSourceOfStatusAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('brand_id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('legal_basis', $data ?? [], null); - $this->setIfExists('preference_group_name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('legal_basis', $data ?? [], null); $this->setIfExists('legal_basis_explanation', $data ?? [], null); - $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('preference_group_name', $data ?? [], null); $this->setIfExists('source_of_status', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); } /** @@ -387,12 +387,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } if ($this->container['description'] === null) { $invalidProperties[] = "'description' can't be null"; } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } $allowedValues = $this->getLegalBasisAllowableValues(); if (!is_null($this->container['legal_basis']) && !in_array($this->container['legal_basis'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -402,21 +402,9 @@ public function listInvalidProperties() ); } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' 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['name'] === null) { + $invalidProperties[] = "'name' can't be null"; } - if ($this->container['source_of_status'] === null) { $invalidProperties[] = "'source_of_status' can't be null"; } @@ -429,6 +417,18 @@ public function listInvalidProperties() ); } + 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; } @@ -472,55 +472,55 @@ public function setBrandId($brand_id) } /** - * Gets name + * Gets description * * @return string */ - public function getName() + public function getDescription() { - return $this->container['name']; + return $this->container['description']; } /** - * Sets name + * Sets description * - * @param string $name The name of the subscription. + * @param string $description A description of the subscription. * * @return self */ - public function setName($name) + public function setDescription($description) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['name'] = $name; + $this->container['description'] = $description; return $this; } /** - * Gets description + * Gets id * * @return string */ - public function getDescription() + public function getId() { - return $this->container['description']; + return $this->container['id']; } /** - * Sets description + * Sets id * - * @param string $description A description of the subscription. + * @param string $id The ID for the subscription. * * @return self */ - public function setDescription($description) + public function setId($id) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['description'] = $description; + $this->container['id'] = $id; return $this; } @@ -563,167 +563,167 @@ public function setLegalBasis($legal_basis) } /** - * Gets preference_group_name + * Gets legal_basis_explanation * * @return string|null */ - public function getPreferenceGroupName() + public function getLegalBasisExplanation() { - return $this->container['preference_group_name']; + return $this->container['legal_basis_explanation']; } /** - * Sets preference_group_name + * Sets legal_basis_explanation * - * @param string|null $preference_group_name The name of the preferences group that the subscription is associated with. + * @param string|null $legal_basis_explanation A more detailed explanation to go with the legal basis. * * @return self */ - public function setPreferenceGroupName($preference_group_name) + public function setLegalBasisExplanation($legal_basis_explanation) { - if (is_null($preference_group_name)) { - throw new \InvalidArgumentException('non-nullable preference_group_name cannot be null'); + if (is_null($legal_basis_explanation)) { + throw new \InvalidArgumentException('non-nullable legal_basis_explanation cannot be null'); } - $this->container['preference_group_name'] = $preference_group_name; + $this->container['legal_basis_explanation'] = $legal_basis_explanation; return $this; } /** - * Gets id + * Gets name * * @return string */ - public function getId() + public function getName() { - return $this->container['id']; + return $this->container['name']; } /** - * Sets id + * Sets name * - * @param string $id The ID for the subscription. + * @param string $name The name of the subscription. * * @return self */ - public function setId($id) + public function setName($name) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['id'] = $id; + $this->container['name'] = $name; return $this; } /** - * Gets legal_basis_explanation + * Gets preference_group_name * * @return string|null */ - public function getLegalBasisExplanation() + public function getPreferenceGroupName() { - return $this->container['legal_basis_explanation']; + return $this->container['preference_group_name']; } /** - * Sets legal_basis_explanation + * Sets preference_group_name * - * @param string|null $legal_basis_explanation A more detailed explanation to go with the legal basis. + * @param string|null $preference_group_name The name of the preferences group that the subscription is associated with. * * @return self */ - public function setLegalBasisExplanation($legal_basis_explanation) + public function setPreferenceGroupName($preference_group_name) { - if (is_null($legal_basis_explanation)) { - throw new \InvalidArgumentException('non-nullable legal_basis_explanation cannot be null'); + if (is_null($preference_group_name)) { + throw new \InvalidArgumentException('non-nullable preference_group_name cannot be null'); } - $this->container['legal_basis_explanation'] = $legal_basis_explanation; + $this->container['preference_group_name'] = $preference_group_name; return $this; } /** - * Gets status + * Gets source_of_status * * @return string */ - public function getStatus() + public function getSourceOfStatus() { - return $this->container['status']; + return $this->container['source_of_status']; } /** - * Sets status + * Sets source_of_status * - * @param string $status Whether the contact is subscribed. + * @param string $source_of_status Where the status is determined from e.g. PORTAL_WIDE_STATUS if the contact opted out from the portal. * * @return self */ - public function setStatus($status) + public function setSourceOfStatus($source_of_status) { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); + if (is_null($source_of_status)) { + throw new \InvalidArgumentException('non-nullable source_of_status cannot be null'); } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { + $allowedValues = $this->getSourceOfStatusAllowableValues(); + if (!in_array($source_of_status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, + "Invalid value '%s' for 'source_of_status', must be one of '%s'", + $source_of_status, implode("', '", $allowedValues) ) ); } - $this->container['status'] = $status; + $this->container['source_of_status'] = $source_of_status; return $this; } /** - * Gets source_of_status + * Gets status * * @return string */ - public function getSourceOfStatus() + public function getStatus() { - return $this->container['source_of_status']; + return $this->container['status']; } /** - * Sets source_of_status + * Sets status * - * @param string $source_of_status Where the status is determined from e.g. PORTAL_WIDE_STATUS if the contact opted out from the portal. + * @param string $status Whether the contact is subscribed. * * @return self */ - public function setSourceOfStatus($source_of_status) + public function setStatus($status) { - if (is_null($source_of_status)) { - throw new \InvalidArgumentException('non-nullable source_of_status cannot be null'); + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $allowedValues = $this->getSourceOfStatusAllowableValues(); - if (!in_array($source_of_status, $allowedValues, true)) { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value '%s' for 'source_of_status', must be one of '%s'", - $source_of_status, + "Invalid value '%s' for 'status', must be one of '%s'", + $status, implode("', '", $allowedValues) ) ); } - $this->container['source_of_status'] = $source_of_status; + $this->container['status'] = $status; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -731,12 +731,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -761,11 +761,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php index e707071c..1bdc196a 100644 --- a/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php +++ b/codegen/CommunicationPreferences/Model/PublicSubscriptionStatusesResponse.php @@ -2,7 +2,7 @@ /** * PublicSubscriptionStatusesResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -358,11 +358,11 @@ public function setSubscriptionStatuses($subscription_statuses) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -370,12 +370,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -400,11 +400,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php b/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php index 7b2da3be..1f22e6ed 100644 --- a/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php +++ b/codegen/CommunicationPreferences/Model/PublicUpdateSubscriptionStatusRequest.php @@ -2,7 +2,7 @@ /** * PublicUpdateSubscriptionStatusRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -59,8 +59,8 @@ class PublicUpdateSubscriptionStatusRequest implements ModelInterface, ArrayAcce protected static $openAPITypes = [ 'email_address' => 'string', 'legal_basis' => 'string', - 'subscription_id' => 'string', - 'legal_basis_explanation' => 'string' + 'legal_basis_explanation' => 'string', + 'subscription_id' => 'string' ]; /** @@ -73,8 +73,8 @@ class PublicUpdateSubscriptionStatusRequest implements ModelInterface, ArrayAcce protected static $openAPIFormats = [ 'email_address' => null, 'legal_basis' => null, - 'subscription_id' => null, - 'legal_basis_explanation' => null + 'legal_basis_explanation' => null, + 'subscription_id' => null ]; /** @@ -85,8 +85,8 @@ class PublicUpdateSubscriptionStatusRequest implements ModelInterface, ArrayAcce protected static array $openAPINullables = [ 'email_address' => false, 'legal_basis' => false, - 'subscription_id' => false, - 'legal_basis_explanation' => false + 'legal_basis_explanation' => false, + 'subscription_id' => false ]; /** @@ -177,8 +177,8 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'email_address' => 'emailAddress', 'legal_basis' => 'legalBasis', - 'subscription_id' => 'subscriptionId', - 'legal_basis_explanation' => 'legalBasisExplanation' + 'legal_basis_explanation' => 'legalBasisExplanation', + 'subscription_id' => 'subscriptionId' ]; /** @@ -189,8 +189,8 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'email_address' => 'setEmailAddress', 'legal_basis' => 'setLegalBasis', - 'subscription_id' => 'setSubscriptionId', - 'legal_basis_explanation' => 'setLegalBasisExplanation' + 'legal_basis_explanation' => 'setLegalBasisExplanation', + 'subscription_id' => 'setSubscriptionId' ]; /** @@ -201,8 +201,8 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'email_address' => 'getEmailAddress', 'legal_basis' => 'getLegalBasis', - 'subscription_id' => 'getSubscriptionId', - 'legal_basis_explanation' => 'getLegalBasisExplanation' + 'legal_basis_explanation' => 'getLegalBasisExplanation', + 'subscription_id' => 'getSubscriptionId' ]; /** @@ -246,13 +246,13 @@ public function getModelName() return self::$openAPIModelName; } - public const LEGAL_BASIS_LEGITIMATE_INTEREST_PQL = 'LEGITIMATE_INTEREST_PQL'; - public const LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT = 'LEGITIMATE_INTEREST_CLIENT'; - public const LEGAL_BASIS_PERFORMANCE_OF_CONTRACT = 'PERFORMANCE_OF_CONTRACT'; public const LEGAL_BASIS_CONSENT_WITH_NOTICE = 'CONSENT_WITH_NOTICE'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT = 'LEGITIMATE_INTEREST_CLIENT'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER = 'LEGITIMATE_INTEREST_OTHER'; + public const LEGAL_BASIS_LEGITIMATE_INTEREST_PQL = 'LEGITIMATE_INTEREST_PQL'; public const LEGAL_BASIS_NON_GDPR = 'NON_GDPR'; + public const LEGAL_BASIS_PERFORMANCE_OF_CONTRACT = 'PERFORMANCE_OF_CONTRACT'; public const LEGAL_BASIS_PROCESS_AND_STORE = 'PROCESS_AND_STORE'; - public const LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER = 'LEGITIMATE_INTEREST_OTHER'; /** * Gets allowable values of the enum @@ -262,13 +262,13 @@ public function getModelName() public function getLegalBasisAllowableValues() { return [ - self::LEGAL_BASIS_LEGITIMATE_INTEREST_PQL, - self::LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT, - self::LEGAL_BASIS_PERFORMANCE_OF_CONTRACT, self::LEGAL_BASIS_CONSENT_WITH_NOTICE, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_CLIENT, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER, + self::LEGAL_BASIS_LEGITIMATE_INTEREST_PQL, self::LEGAL_BASIS_NON_GDPR, + self::LEGAL_BASIS_PERFORMANCE_OF_CONTRACT, self::LEGAL_BASIS_PROCESS_AND_STORE, - self::LEGAL_BASIS_LEGITIMATE_INTEREST_OTHER, ]; } @@ -289,8 +289,8 @@ public function __construct(?array $data = null) { $this->setIfExists('email_address', $data ?? [], null); $this->setIfExists('legal_basis', $data ?? [], null); - $this->setIfExists('subscription_id', $data ?? [], null); $this->setIfExists('legal_basis_explanation', $data ?? [], null); + $this->setIfExists('subscription_id', $data ?? [], null); } /** @@ -415,66 +415,66 @@ public function setLegalBasis($legal_basis) } /** - * Gets subscription_id + * Gets legal_basis_explanation * - * @return string + * @return string|null */ - public function getSubscriptionId() + public function getLegalBasisExplanation() { - return $this->container['subscription_id']; + return $this->container['legal_basis_explanation']; } /** - * Sets subscription_id + * Sets legal_basis_explanation * - * @param string $subscription_id ID of the subscription being updated for the contact. + * @param string|null $legal_basis_explanation A more detailed explanation to go with the legal basis (required for GDPR enabled portals). * * @return self */ - public function setSubscriptionId($subscription_id) + public function setLegalBasisExplanation($legal_basis_explanation) { - if (is_null($subscription_id)) { - throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); + if (is_null($legal_basis_explanation)) { + throw new \InvalidArgumentException('non-nullable legal_basis_explanation cannot be null'); } - $this->container['subscription_id'] = $subscription_id; + $this->container['legal_basis_explanation'] = $legal_basis_explanation; return $this; } /** - * Gets legal_basis_explanation + * Gets subscription_id * - * @return string|null + * @return string */ - public function getLegalBasisExplanation() + public function getSubscriptionId() { - return $this->container['legal_basis_explanation']; + return $this->container['subscription_id']; } /** - * Sets legal_basis_explanation + * Sets subscription_id * - * @param string|null $legal_basis_explanation A more detailed explanation to go with the legal basis (required for GDPR enabled portals). + * @param string $subscription_id ID of the subscription being updated for the contact. * * @return self */ - public function setLegalBasisExplanation($legal_basis_explanation) + public function setSubscriptionId($subscription_id) { - if (is_null($legal_basis_explanation)) { - throw new \InvalidArgumentException('non-nullable legal_basis_explanation cannot be null'); + if (is_null($subscription_id)) { + throw new \InvalidArgumentException('non-nullable subscription_id cannot be null'); } - $this->container['legal_basis_explanation'] = $legal_basis_explanation; + $this->container['subscription_id'] = $subscription_id; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -482,12 +482,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -512,11 +512,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php b/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php index 8e74c23f..e4983352 100644 --- a/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php +++ b/codegen/CommunicationPreferences/Model/SubscriptionDefinition.php @@ -2,7 +2,7 @@ /** * SubscriptionDefinition * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,16 +57,16 @@ class SubscriptionDefinition implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ - 'is_internal' => 'bool', - 'created_at' => '\DateTime', - 'is_default' => 'bool', + 'business_unit_id' => 'int', 'communication_method' => 'string', - 'purpose' => 'string', - 'name' => 'string', + 'created_at' => '\DateTime', 'description' => 'string', 'id' => 'string', 'is_active' => 'bool', - 'business_unit_id' => 'int', + 'is_default' => 'bool', + 'is_internal' => 'bool', + 'name' => 'string', + 'purpose' => 'string', 'updated_at' => '\DateTime' ]; @@ -78,16 +78,16 @@ class SubscriptionDefinition implements ModelInterface, ArrayAccess, \JsonSerial * @psalm-var array */ protected static $openAPIFormats = [ - 'is_internal' => null, - 'created_at' => 'date-time', - 'is_default' => null, + 'business_unit_id' => 'int64', 'communication_method' => null, - 'purpose' => null, - 'name' => null, + 'created_at' => 'date-time', 'description' => null, 'id' => null, 'is_active' => null, - 'business_unit_id' => 'int64', + 'is_default' => null, + 'is_internal' => null, + 'name' => null, + 'purpose' => null, 'updated_at' => 'date-time' ]; @@ -97,16 +97,16 @@ class SubscriptionDefinition implements ModelInterface, ArrayAccess, \JsonSerial * @var boolean[] */ protected static array $openAPINullables = [ - 'is_internal' => false, - 'created_at' => false, - 'is_default' => false, + 'business_unit_id' => false, 'communication_method' => false, - 'purpose' => false, - 'name' => false, + 'created_at' => false, 'description' => false, 'id' => false, 'is_active' => false, - 'business_unit_id' => false, + 'is_default' => false, + 'is_internal' => false, + 'name' => false, + 'purpose' => false, 'updated_at' => false ]; @@ -196,16 +196,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'is_internal' => 'isInternal', - 'created_at' => 'createdAt', - 'is_default' => 'isDefault', + 'business_unit_id' => 'businessUnitId', 'communication_method' => 'communicationMethod', - 'purpose' => 'purpose', - 'name' => 'name', + 'created_at' => 'createdAt', 'description' => 'description', 'id' => 'id', 'is_active' => 'isActive', - 'business_unit_id' => 'businessUnitId', + 'is_default' => 'isDefault', + 'is_internal' => 'isInternal', + 'name' => 'name', + 'purpose' => 'purpose', 'updated_at' => 'updatedAt' ]; @@ -215,16 +215,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'is_internal' => 'setIsInternal', - 'created_at' => 'setCreatedAt', - 'is_default' => 'setIsDefault', + 'business_unit_id' => 'setBusinessUnitId', 'communication_method' => 'setCommunicationMethod', - 'purpose' => 'setPurpose', - 'name' => 'setName', + 'created_at' => 'setCreatedAt', 'description' => 'setDescription', 'id' => 'setId', 'is_active' => 'setIsActive', - 'business_unit_id' => 'setBusinessUnitId', + 'is_default' => 'setIsDefault', + 'is_internal' => 'setIsInternal', + 'name' => 'setName', + 'purpose' => 'setPurpose', 'updated_at' => 'setUpdatedAt' ]; @@ -234,16 +234,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'is_internal' => 'getIsInternal', - 'created_at' => 'getCreatedAt', - 'is_default' => 'getIsDefault', + 'business_unit_id' => 'getBusinessUnitId', 'communication_method' => 'getCommunicationMethod', - 'purpose' => 'getPurpose', - 'name' => 'getName', + 'created_at' => 'getCreatedAt', 'description' => 'getDescription', 'id' => 'getId', 'is_active' => 'getIsActive', - 'business_unit_id' => 'getBusinessUnitId', + 'is_default' => 'getIsDefault', + 'is_internal' => 'getIsInternal', + 'name' => 'getName', + 'purpose' => 'getPurpose', 'updated_at' => 'getUpdatedAt' ]; @@ -304,16 +304,16 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('is_internal', $data ?? [], null); - $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('is_default', $data ?? [], null); + $this->setIfExists('business_unit_id', $data ?? [], null); $this->setIfExists('communication_method', $data ?? [], null); - $this->setIfExists('purpose', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('is_active', $data ?? [], null); - $this->setIfExists('business_unit_id', $data ?? [], null); + $this->setIfExists('is_default', $data ?? [], null); + $this->setIfExists('is_internal', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('purpose', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -344,18 +344,9 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['is_internal'] === null) { - $invalidProperties[] = "'is_internal' can't be null"; - } if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } - if ($this->container['is_default'] === null) { - $invalidProperties[] = "'is_default' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } if ($this->container['description'] === null) { $invalidProperties[] = "'description' can't be null"; } @@ -365,6 +356,15 @@ public function listInvalidProperties() if ($this->container['is_active'] === null) { $invalidProperties[] = "'is_active' can't be null"; } + if ($this->container['is_default'] === null) { + $invalidProperties[] = "'is_default' can't be null"; + } + if ($this->container['is_internal'] === null) { + $invalidProperties[] = "'is_internal' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } if ($this->container['updated_at'] === null) { $invalidProperties[] = "'updated_at' can't be null"; } @@ -384,271 +384,271 @@ public function valid() /** - * Gets is_internal + * Gets business_unit_id * - * @return bool + * @return int|null */ - public function getIsInternal() + public function getBusinessUnitId() { - return $this->container['is_internal']; + return $this->container['business_unit_id']; } /** - * Sets is_internal + * Sets business_unit_id * - * @param bool $is_internal A default description that is used by some HubSpot tools and cannot be edited. + * @param int|null $business_unit_id The ID of the business unit associated with the subscription definition. * * @return self */ - public function setIsInternal($is_internal) + public function setBusinessUnitId($business_unit_id) { - if (is_null($is_internal)) { - throw new \InvalidArgumentException('non-nullable is_internal cannot be null'); + if (is_null($business_unit_id)) { + throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); } - $this->container['is_internal'] = $is_internal; + $this->container['business_unit_id'] = $business_unit_id; return $this; } /** - * Gets created_at + * Gets communication_method * - * @return \DateTime + * @return string|null */ - public function getCreatedAt() + public function getCommunicationMethod() { - return $this->container['created_at']; + return $this->container['communication_method']; } /** - * Sets created_at + * Sets communication_method * - * @param \DateTime $created_at Time at which the definition was created. + * @param string|null $communication_method The method or technology used to contact. * * @return self */ - public function setCreatedAt($created_at) + public function setCommunicationMethod($communication_method) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($communication_method)) { + throw new \InvalidArgumentException('non-nullable communication_method cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['communication_method'] = $communication_method; return $this; } /** - * Gets is_default + * Gets created_at * - * @return bool + * @return \DateTime */ - public function getIsDefault() + public function getCreatedAt() { - return $this->container['is_default']; + return $this->container['created_at']; } /** - * Sets is_default + * Sets created_at * - * @param bool $is_default A subscription definition created by HubSpot. + * @param \DateTime $created_at Time at which the definition was created. * * @return self */ - public function setIsDefault($is_default) + public function setCreatedAt($created_at) { - if (is_null($is_default)) { - throw new \InvalidArgumentException('non-nullable is_default cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['is_default'] = $is_default; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets communication_method + * Gets description * - * @return string|null + * @return string */ - public function getCommunicationMethod() + public function getDescription() { - return $this->container['communication_method']; + return $this->container['description']; } /** - * Sets communication_method + * Sets description * - * @param string|null $communication_method The method or technology used to contact. + * @param string $description A description of the subscription. * * @return self */ - public function setCommunicationMethod($communication_method) + public function setDescription($description) { - if (is_null($communication_method)) { - throw new \InvalidArgumentException('non-nullable communication_method cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['communication_method'] = $communication_method; + $this->container['description'] = $description; return $this; } /** - * Gets purpose + * Gets id * - * @return string|null + * @return string */ - public function getPurpose() + public function getId() { - return $this->container['purpose']; + return $this->container['id']; } /** - * Sets purpose + * Sets id * - * @param string|null $purpose The purpose of this subscription or the department in your organization that uses it. + * @param string $id The ID of the definition. * * @return self */ - public function setPurpose($purpose) + public function setId($id) { - if (is_null($purpose)) { - throw new \InvalidArgumentException('non-nullable purpose cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['purpose'] = $purpose; + $this->container['id'] = $id; return $this; } /** - * Gets name + * Gets is_active * - * @return string + * @return bool */ - public function getName() + public function getIsActive() { - return $this->container['name']; + return $this->container['is_active']; } /** - * Sets name + * Sets is_active * - * @param string $name The name of the subscription. + * @param bool $is_active Whether the definition is active or archived. * * @return self */ - public function setName($name) + public function setIsActive($is_active) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($is_active)) { + throw new \InvalidArgumentException('non-nullable is_active cannot be null'); } - $this->container['name'] = $name; + $this->container['is_active'] = $is_active; return $this; } /** - * Gets description + * Gets is_default * - * @return string + * @return bool */ - public function getDescription() + public function getIsDefault() { - return $this->container['description']; + return $this->container['is_default']; } /** - * Sets description + * Sets is_default * - * @param string $description A description of the subscription. + * @param bool $is_default A subscription definition created by HubSpot. * * @return self */ - public function setDescription($description) + public function setIsDefault($is_default) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($is_default)) { + throw new \InvalidArgumentException('non-nullable is_default cannot be null'); } - $this->container['description'] = $description; + $this->container['is_default'] = $is_default; return $this; } /** - * Gets id + * Gets is_internal * - * @return string + * @return bool */ - public function getId() + public function getIsInternal() { - return $this->container['id']; + return $this->container['is_internal']; } /** - * Sets id + * Sets is_internal * - * @param string $id The ID of the definition. + * @param bool $is_internal A default description that is used by some HubSpot tools and cannot be edited. * * @return self */ - public function setId($id) + public function setIsInternal($is_internal) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($is_internal)) { + throw new \InvalidArgumentException('non-nullable is_internal cannot be null'); } - $this->container['id'] = $id; + $this->container['is_internal'] = $is_internal; return $this; } /** - * Gets is_active + * Gets name * - * @return bool + * @return string */ - public function getIsActive() + public function getName() { - return $this->container['is_active']; + return $this->container['name']; } /** - * Sets is_active + * Sets name * - * @param bool $is_active Whether the definition is active or archived. + * @param string $name The name of the subscription. * * @return self */ - public function setIsActive($is_active) + public function setName($name) { - if (is_null($is_active)) { - throw new \InvalidArgumentException('non-nullable is_active cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['is_active'] = $is_active; + $this->container['name'] = $name; return $this; } /** - * Gets business_unit_id + * Gets purpose * - * @return int|null + * @return string|null */ - public function getBusinessUnitId() + public function getPurpose() { - return $this->container['business_unit_id']; + return $this->container['purpose']; } /** - * Sets business_unit_id + * Sets purpose * - * @param int|null $business_unit_id business_unit_id + * @param string|null $purpose The purpose of this subscription or the department in your organization that uses it. * * @return self */ - public function setBusinessUnitId($business_unit_id) + public function setPurpose($purpose) { - if (is_null($business_unit_id)) { - throw new \InvalidArgumentException('non-nullable business_unit_id cannot be null'); + if (is_null($purpose)) { + throw new \InvalidArgumentException('non-nullable purpose cannot be null'); } - $this->container['business_unit_id'] = $business_unit_id; + $this->container['purpose'] = $purpose; return $this; } @@ -682,11 +682,11 @@ public function setUpdatedAt($updated_at) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -694,12 +694,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -724,11 +724,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php b/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php index 7ee533f9..a7019d5a 100644 --- a/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php +++ b/codegen/CommunicationPreferences/Model/SubscriptionDefinitionsResponse.php @@ -2,7 +2,7 @@ /** * SubscriptionDefinitionsResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -321,11 +321,11 @@ public function setSubscriptionDefinitions($subscription_definitions) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/CommunicationPreferences/ObjectSerializer.php b/codegen/CommunicationPreferences/ObjectSerializer.php index 9ca6f157..1be813cb 100644 --- a/codegen/CommunicationPreferences/ObjectSerializer.php +++ b/codegen/CommunicationPreferences/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\CommunicationPreferences @@ -11,13 +11,13 @@ */ /** - * Subscriptions + * Communication Preferences Subscriptions * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -323,24 +323,6 @@ public static function toHeaderValue($value) 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($value) - { - 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 @@ -612,6 +594,6 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } } - return $qs ? (string) substr($qs, 0, -1) : ''; + return $qs ? substr($qs, 0, -1) : ''; } } From 3de2e98bc8da9323dabc258c80e2b6f944c8163c Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 9 Feb 2026 16:25:54 +0300 Subject: [PATCH 2/2] Update discovery Communication Preferences --- lib/Discovery/CommunicationPreferences/Discovery.php | 6 +++--- .../Discovery/CommunicationPreferences/DiscoverySpec.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Discovery/CommunicationPreferences/Discovery.php b/lib/Discovery/CommunicationPreferences/Discovery.php index 386d2a6c..d7d3845a 100644 --- a/lib/Discovery/CommunicationPreferences/Discovery.php +++ b/lib/Discovery/CommunicationPreferences/Discovery.php @@ -2,12 +2,12 @@ namespace HubSpot\Discovery\CommunicationPreferences; -use HubSpot\Client\CommunicationPreferences\Api\DefinitionApi; +use HubSpot\Client\CommunicationPreferences\Api\DefinitionsApi; use HubSpot\Client\CommunicationPreferences\Api\StatusApi; use HubSpot\Discovery\DiscoveryBase; /** - * @method DefinitionApi definitionApi() - * @method StatusApi statusApi() + * @method DefinitionsApi definitionsApi() + * @method StatusApi statusApi() */ class Discovery extends DiscoveryBase {} diff --git a/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php b/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php index 0d44cdc1..84cd4d91 100644 --- a/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php +++ b/tests/spec/Discovery/CommunicationPreferences/DiscoverySpec.php @@ -3,7 +3,7 @@ namespace spec\HubSpot\Discovery\CommunicationPreferences; use GuzzleHttp\Client; -use HubSpot\Client\CommunicationPreferences\Api\DefinitionApi; +use HubSpot\Client\CommunicationPreferences\Api\DefinitionsApi; use HubSpot\Client\CommunicationPreferences\Api\StatusApi; use HubSpot\Config; use HubSpot\Discovery\CommunicationPreferences\Discovery; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->definitionApi()->shouldHaveType(DefinitionApi::class); + $this->definitionsApi()->shouldHaveType(DefinitionsApi::class); $this->statusApi()->shouldHaveType(StatusApi::class); } }