From f633a5d91a1d42df5da35572eafb6a75ae9e0a89 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Wed, 18 Feb 2026 11:18:46 +0300 Subject: [PATCH 1/2] Codegen: Marketing Transactional --- ...licSMTPTokensApi.php => SMTPTokensApi.php} | 481 ++++++------------ ...dApi.php => SendTransactionalEmailApi.php} | 175 +++---- .../Marketing/Transactional/ApiException.php | 4 +- .../Marketing/Transactional/Configuration.php | 63 ++- .../Transactional/FormDataProcessor.php | 246 +++++++++ .../Transactional/HeaderSelector.php | 4 +- ...nResponseSmtpApiTokenViewForwardPaging.php | 16 +- .../Model/EmailSendStatusView.php | 358 +++++++------ .../Marketing/Transactional/Model/Error.php | 158 +++--- .../Transactional/Model/ErrorDetail.php | 134 ++--- .../Transactional/Model/EventIdView.php | 16 +- .../Transactional/Model/ForwardPaging.php | 16 +- .../Transactional/Model/ModelInterface.php | 4 +- .../Transactional/Model/NextPage.php | 83 +-- .../Model/PublicSingleSendEmail.php | 134 ++--- .../Model/PublicSingleSendRequestEgg.php | 98 ++-- .../Model/SmtpApiTokenRequestEgg.php | 88 ++-- .../Transactional/Model/SmtpApiTokenView.php | 224 ++++---- .../Transactional/ObjectSerializer.php | 24 +- 19 files changed, 1230 insertions(+), 1096 deletions(-) rename codegen/Marketing/Transactional/Api/{PublicSMTPTokensApi.php => SMTPTokensApi.php} (78%) rename codegen/Marketing/Transactional/Api/{SingleSendApi.php => SendTransactionalEmailApi.php} (77%) create mode 100644 codegen/Marketing/Transactional/FormDataProcessor.php diff --git a/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php similarity index 78% rename from codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php rename to codegen/Marketing/Transactional/Api/SMTPTokensApi.php index dcb357a8..c945a24d 100644 --- a/codegen/Marketing/Transactional/Api/PublicSMTPTokensApi.php +++ b/codegen/Marketing/Transactional/Api/SMTPTokensApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -201,8 +203,10 @@ public function archiveTokenWithHttpInfo($token_id, string $contentType = self:: $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -422,61 +426,21 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con switch($statusCode) { case 201: - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Marketing\Transactional\Model\SmtpApiTokenView', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); default: - if ('\HubSpot\Client\Marketing\Transactional\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -490,34 +454,11 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con ); } - $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; - 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\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -527,7 +468,7 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -535,8 +476,10 @@ public function createTokenWithHttpInfo($smtp_api_token_request_egg, string $con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -768,61 +711,21 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Marketing\Transactional\Model\SmtpApiTokenView', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); default: - if ('\HubSpot\Client\Marketing\Transactional\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -836,34 +739,11 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: ); } - $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; - 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\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -873,7 +753,7 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -881,8 +761,10 @@ public function getTokenByIdWithHttpInfo($token_id, string $contentType = self:: $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1121,61 +1003,21 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging', + $request, + $response, + ); default: - if ('\HubSpot\Client\Marketing\Transactional\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1189,34 +1031,11 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign ); } - $returnType = '\HubSpot\Client\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging'; - 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\Marketing\Transactional\Model\CollectionResponseSmtpApiTokenViewForwardPaging', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1226,7 +1045,7 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1234,8 +1053,10 @@ public function getTokensPageWithHttpInfo($campaign_name = null, $email_campaign $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1502,61 +1323,21 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: switch($statusCode) { case 200: - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Marketing\Transactional\Model\SmtpApiTokenView', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); default: - if ('\HubSpot\Client\Marketing\Transactional\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1570,34 +1351,11 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: ); } - $returnType = '\HubSpot\Client\Marketing\Transactional\Model\SmtpApiTokenView'; - 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\Marketing\Transactional\Model\SmtpApiTokenView', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1607,7 +1365,7 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1615,8 +1373,10 @@ public function resetPasswordWithHttpInfo($token_id, string $contentType = self: $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1806,6 +1566,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/Marketing/Transactional/Api/SingleSendApi.php b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php similarity index 77% rename from codegen/Marketing/Transactional/Api/SingleSendApi.php rename to codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php index 7586554d..30680e3c 100644 --- a/codegen/Marketing/Transactional/Api/SingleSendApi.php +++ b/codegen/Marketing/Transactional/Api/SendTransactionalEmailApi.php @@ -1,7 +1,7 @@ getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\Model\EmailSendStatusView' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Marketing\Transactional\Model\EmailSendStatusView', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\EmailSendStatusView', + $request, + $response, + ); default: - if ('\HubSpot\Client\Marketing\Transactional\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Marketing\Transactional\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -249,34 +212,11 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c ); } - $returnType = '\HubSpot\Client\Marketing\Transactional\Model\EmailSendStatusView'; - 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\Marketing\Transactional\Model\EmailSendStatusView', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -286,7 +226,7 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -294,8 +234,10 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -303,7 +245,7 @@ public function sendEmailWithHttpInfo($public_single_send_request_egg, string $c /** * Operation sendEmailAsync * - * Send a single transactional email asynchronously. + * Send a single send transactional email asynchronously. * * @param \HubSpot\Client\Marketing\Transactional\Model\PublicSingleSendRequestEgg $public_single_send_request_egg A request object describing the email to send. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation @@ -324,7 +266,7 @@ function ($response) { /** * Operation sendEmailAsyncWithHttpInfo * - * Send a single transactional email asynchronously. + * Send a single send transactional email asynchronously. * * @param \HubSpot\Client\Marketing\Transactional\Model\PublicSingleSendRequestEgg $public_single_send_request_egg A request object describing the email to send. (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendEmail'] to see the possible values for this operation @@ -484,6 +426,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/Marketing/Transactional/ApiException.php b/codegen/Marketing/Transactional/ApiException.php index 620bdc1b..660ca076 100644 --- a/codegen/Marketing/Transactional/ApiException.php +++ b/codegen/Marketing/Transactional/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/Marketing/Transactional/FormDataProcessor.php b/codegen/Marketing/Transactional/FormDataProcessor.php new file mode 100644 index 00000000..3acd40e3 --- /dev/null +++ b/codegen/Marketing/Transactional/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/Marketing/Transactional/HeaderSelector.php b/codegen/Marketing/Transactional/HeaderSelector.php index c8db1b3a..4c7933ce 100644 --- a/codegen/Marketing/Transactional/HeaderSelector.php +++ b/codegen/Marketing/Transactional/HeaderSelector.php @@ -1,7 +1,7 @@ container[$offset]); } @@ -367,12 +367,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; } @@ -397,11 +397,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/Marketing/Transactional/Model/EmailSendStatusView.php b/codegen/Marketing/Transactional/Model/EmailSendStatusView.php index 20742784..20700841 100644 --- a/codegen/Marketing/Transactional/Model/EmailSendStatusView.php +++ b/codegen/Marketing/Transactional/Model/EmailSendStatusView.php @@ -2,7 +2,7 @@ /** * EmailSendStatusView * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,13 +58,14 @@ class EmailSendStatusView implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'event_id' => '\HubSpot\Client\Marketing\Transactional\Model\EventIdView', 'completed_at' => '\DateTime', - 'status_id' => 'string', - 'send_result' => 'string', + 'event_id' => '\HubSpot\Client\Marketing\Transactional\Model\EventIdView', + 'message' => 'string', 'requested_at' => '\DateTime', + 'send_result' => 'string', 'started_at' => '\DateTime', - 'status' => 'string' + 'status' => 'string', + 'status_id' => 'string' ]; /** @@ -75,13 +76,14 @@ class EmailSendStatusView implements ModelInterface, ArrayAccess, \JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ - 'event_id' => null, 'completed_at' => 'date-time', - 'status_id' => null, - 'send_result' => null, + 'event_id' => null, + 'message' => null, 'requested_at' => 'date-time', + 'send_result' => null, 'started_at' => 'date-time', - 'status' => null + 'status' => null, + 'status_id' => null ]; /** @@ -90,13 +92,14 @@ class EmailSendStatusView implements ModelInterface, ArrayAccess, \JsonSerializa * @var boolean[] */ protected static array $openAPINullables = [ - 'event_id' => false, 'completed_at' => false, - 'status_id' => false, - 'send_result' => false, + 'event_id' => false, + 'message' => false, 'requested_at' => false, + 'send_result' => false, 'started_at' => false, - 'status' => false + 'status' => false, + 'status_id' => false ]; /** @@ -185,13 +188,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'event_id' => 'eventId', 'completed_at' => 'completedAt', - 'status_id' => 'statusId', - 'send_result' => 'sendResult', + 'event_id' => 'eventId', + 'message' => 'message', 'requested_at' => 'requestedAt', + 'send_result' => 'sendResult', 'started_at' => 'startedAt', - 'status' => 'status' + 'status' => 'status', + 'status_id' => 'statusId' ]; /** @@ -200,13 +204,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'event_id' => 'setEventId', 'completed_at' => 'setCompletedAt', - 'status_id' => 'setStatusId', - 'send_result' => 'setSendResult', + 'event_id' => 'setEventId', + 'message' => 'setMessage', 'requested_at' => 'setRequestedAt', + 'send_result' => 'setSendResult', 'started_at' => 'setStartedAt', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'status_id' => 'setStatusId' ]; /** @@ -215,13 +220,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'event_id' => 'getEventId', 'completed_at' => 'getCompletedAt', - 'status_id' => 'getStatusId', - 'send_result' => 'getSendResult', + 'event_id' => 'getEventId', + 'message' => 'getMessage', 'requested_at' => 'getRequestedAt', + 'send_result' => 'getSendResult', 'started_at' => 'getStartedAt', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'status_id' => 'getStatusId' ]; /** @@ -265,53 +271,58 @@ public function getModelName() return self::$openAPIModelName; } - public const SEND_RESULT_SENT = 'SENT'; - public const SEND_RESULT_IDEMPOTENT_IGNORE = 'IDEMPOTENT_IGNORE'; - public const SEND_RESULT_QUEUED = 'QUEUED'; - public const SEND_RESULT_IDEMPOTENT_FAIL = 'IDEMPOTENT_FAIL'; - public const SEND_RESULT_THROTTLED = 'THROTTLED'; - public const SEND_RESULT_EMAIL_DISABLED = 'EMAIL_DISABLED'; - public const SEND_RESULT_PORTAL_SUSPENDED = 'PORTAL_SUSPENDED'; - public const SEND_RESULT_INVALID_TO_ADDRESS = 'INVALID_TO_ADDRESS'; + public const SEND_RESULT_ADDRESS_LIST_BOMBED = 'ADDRESS_LIST_BOMBED'; + public const SEND_RESULT_ADDRESS_ONLY_ACCEPTED_ON_PROD = 'ADDRESS_ONLY_ACCEPTED_ON_PROD'; + public const SEND_RESULT_ADDRESS_OPTED_OUT = 'ADDRESS_OPTED_OUT'; + public const SEND_RESULT_ATTACHMENT_DOWNLOAD_QUEUE_FULL = 'ATTACHMENT_DOWNLOAD_QUEUE_FULL'; + public const SEND_RESULT_BLOCKED_ADDRESS = 'BLOCKED_ADDRESS'; public const SEND_RESULT_BLOCKED_DOMAIN = 'BLOCKED_DOMAIN'; - public const SEND_RESULT_PREVIOUSLY_BOUNCED = 'PREVIOUSLY_BOUNCED'; + public const SEND_RESULT_BRAND_RECIPIENT_FATIGUE_SUPPRESSED = 'BRAND_RECIPIENT_FATIGUE_SUPPRESSED'; + public const SEND_RESULT_CAMPAIGN_CANCELLED = 'CAMPAIGN_CANCELLED'; + public const SEND_RESULT_CANCELLED_ABUSE = 'CANCELLED_ABUSE'; + public const SEND_RESULT_CORRUPT_INPUT = 'CORRUPT_INPUT'; + public const SEND_RESULT_EMAIL_DISABLED = 'EMAIL_DISABLED'; public const SEND_RESULT_EMAIL_UNCONFIRMED = 'EMAIL_UNCONFIRMED'; - public const SEND_RESULT_PREVIOUS_SPAM = 'PREVIOUS_SPAM'; - public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_MESSAGE = 'PREVIOUSLY_UNSUBSCRIBED_MESSAGE'; - public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_PORTAL = 'PREVIOUSLY_UNSUBSCRIBED_PORTAL'; + public const SEND_RESULT_GDPR_DOI_ENABLED = 'GDPR_DOI_ENABLED'; + public const SEND_RESULT_GRAYMAIL_SUPPRESSED = 'GRAYMAIL_SUPPRESSED'; + public const SEND_RESULT_HUBL_LIMIT_EXCEEDED = 'HUBL_LIMIT_EXCEEDED'; + public const SEND_RESULT_IDEMPOTENT_FAIL = 'IDEMPOTENT_FAIL'; + public const SEND_RESULT_IDEMPOTENT_IGNORE = 'IDEMPOTENT_IGNORE'; public const SEND_RESULT_INVALID_FROM_ADDRESS = 'INVALID_FROM_ADDRESS'; - public const SEND_RESULT_CAMPAIGN_CANCELLED = 'CAMPAIGN_CANCELLED'; - public const SEND_RESULT_VALIDATION_FAILED = 'VALIDATION_FAILED'; + public const SEND_RESULT_INVALID_TO_ADDRESS = 'INVALID_TO_ADDRESS'; + public const SEND_RESULT_LOW_CONTACT_QUALITY_SCORE = 'LOW_CONTACT_QUALITY_SCORE'; + public const SEND_RESULT_MISSING_CONTENT = 'MISSING_CONTENT'; + public const SEND_RESULT_MISSING_REQUIRED_PARAMETER = 'MISSING_REQUIRED_PARAMETER'; + public const SEND_RESULT_MISSING_TEMPLATE_PROPERTIES = 'MISSING_TEMPLATE_PROPERTIES'; public const SEND_RESULT_MTA_IGNORE = 'MTA_IGNORE'; - public const SEND_RESULT_BLOCKED_ADDRESS = 'BLOCKED_ADDRESS'; - public const SEND_RESULT_PORTAL_OVER_LIMIT = 'PORTAL_OVER_LIMIT'; + public const SEND_RESULT_NON_MARKETABLE_CONTACT = 'NON_MARKETABLE_CONTACT'; + public const SEND_RESULT_PORTAL_AUTHENTICATION_FAILURE = 'PORTAL_AUTHENTICATION_FAILURE'; public const SEND_RESULT_PORTAL_EXPIRED = 'PORTAL_EXPIRED'; public const SEND_RESULT_PORTAL_MISSING_MARKETING_SCOPE = 'PORTAL_MISSING_MARKETING_SCOPE'; - public const SEND_RESULT_MISSING_TEMPLATE_PROPERTIES = 'MISSING_TEMPLATE_PROPERTIES'; - public const SEND_RESULT_MISSING_REQUIRED_PARAMETER = 'MISSING_REQUIRED_PARAMETER'; - public const SEND_RESULT_PORTAL_AUTHENTICATION_FAILURE = 'PORTAL_AUTHENTICATION_FAILURE'; - public const SEND_RESULT_MISSING_CONTENT = 'MISSING_CONTENT'; - public const SEND_RESULT_CORRUPT_INPUT = 'CORRUPT_INPUT'; - public const SEND_RESULT_TEMPLATE_RENDER_EXCEPTION = 'TEMPLATE_RENDER_EXCEPTION'; - public const SEND_RESULT_GRAYMAIL_SUPPRESSED = 'GRAYMAIL_SUPPRESSED'; - public const SEND_RESULT_UNCONFIGURED_SENDING_DOMAIN = 'UNCONFIGURED_SENDING_DOMAIN'; - public const SEND_RESULT_UNDELIVERABLE = 'UNDELIVERABLE'; - public const SEND_RESULT_CANCELLED_ABUSE = 'CANCELLED_ABUSE'; - public const SEND_RESULT_QUARANTINED_ADDRESS = 'QUARANTINED_ADDRESS'; - public const SEND_RESULT_ADDRESS_ONLY_ACCEPTED_ON_PROD = 'ADDRESS_ONLY_ACCEPTED_ON_PROD'; public const SEND_RESULT_PORTAL_NOT_AUTHORIZED_FOR_APPLICATION = 'PORTAL_NOT_AUTHORIZED_FOR_APPLICATION'; - public const SEND_RESULT_ADDRESS_LIST_BOMBED = 'ADDRESS_LIST_BOMBED'; - public const SEND_RESULT_ADDRESS_OPTED_OUT = 'ADDRESS_OPTED_OUT'; - public const SEND_RESULT_RECIPIENT_FATIGUE_SUPPRESSED = 'RECIPIENT_FATIGUE_SUPPRESSED'; - public const SEND_RESULT_TOO_MANY_RECIPIENTS = 'TOO_MANY_RECIPIENTS'; + public const SEND_RESULT_PORTAL_OVER_LIMIT = 'PORTAL_OVER_LIMIT'; + public const SEND_RESULT_PORTAL_SUSPENDED = 'PORTAL_SUSPENDED'; + public const SEND_RESULT_PREVIOUS_SPAM = 'PREVIOUS_SPAM'; + public const SEND_RESULT_PREVIOUSLY_BOUNCED = 'PREVIOUSLY_BOUNCED'; public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_BRAND = 'PREVIOUSLY_UNSUBSCRIBED_BRAND'; - public const SEND_RESULT_NON_MARKETABLE_CONTACT = 'NON_MARKETABLE_CONTACT'; public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_BUSINESS_UNIT = 'PREVIOUSLY_UNSUBSCRIBED_BUSINESS_UNIT'; - public const SEND_RESULT_GDPR_DOI_ENABLED = 'GDPR_DOI_ENABLED'; - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; + public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_MESSAGE = 'PREVIOUSLY_UNSUBSCRIBED_MESSAGE'; + public const SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_PORTAL = 'PREVIOUSLY_UNSUBSCRIBED_PORTAL'; + public const SEND_RESULT_QUARANTINED_ADDRESS = 'QUARANTINED_ADDRESS'; + public const SEND_RESULT_QUEUED = 'QUEUED'; + public const SEND_RESULT_RECIPIENT_FATIGUE_SUPPRESSED = 'RECIPIENT_FATIGUE_SUPPRESSED'; + public const SEND_RESULT_SENT = 'SENT'; + public const SEND_RESULT_TEMPLATE_RENDER_EXCEPTION = 'TEMPLATE_RENDER_EXCEPTION'; + public const SEND_RESULT_THROTTLED = 'THROTTLED'; + public const SEND_RESULT_TOO_MANY_RECIPIENTS = 'TOO_MANY_RECIPIENTS'; + public const SEND_RESULT_UBB_GOVERNANCE_MISSING = 'UBB_GOVERNANCE_MISSING'; + public const SEND_RESULT_UNCONFIGURED_SENDING_DOMAIN = 'UNCONFIGURED_SENDING_DOMAIN'; + public const SEND_RESULT_UNDELIVERABLE = 'UNDELIVERABLE'; + public const SEND_RESULT_VALIDATION_FAILED = 'VALIDATION_FAILED'; public const STATUS_CANCELED = 'CANCELED'; public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; /** * Gets allowable values of the enum @@ -321,49 +332,54 @@ public function getModelName() public function getSendResultAllowableValues() { return [ - self::SEND_RESULT_SENT, - self::SEND_RESULT_IDEMPOTENT_IGNORE, - self::SEND_RESULT_QUEUED, - self::SEND_RESULT_IDEMPOTENT_FAIL, - self::SEND_RESULT_THROTTLED, - self::SEND_RESULT_EMAIL_DISABLED, - self::SEND_RESULT_PORTAL_SUSPENDED, - self::SEND_RESULT_INVALID_TO_ADDRESS, + self::SEND_RESULT_ADDRESS_LIST_BOMBED, + self::SEND_RESULT_ADDRESS_ONLY_ACCEPTED_ON_PROD, + self::SEND_RESULT_ADDRESS_OPTED_OUT, + self::SEND_RESULT_ATTACHMENT_DOWNLOAD_QUEUE_FULL, + self::SEND_RESULT_BLOCKED_ADDRESS, self::SEND_RESULT_BLOCKED_DOMAIN, - self::SEND_RESULT_PREVIOUSLY_BOUNCED, + self::SEND_RESULT_BRAND_RECIPIENT_FATIGUE_SUPPRESSED, + self::SEND_RESULT_CAMPAIGN_CANCELLED, + self::SEND_RESULT_CANCELLED_ABUSE, + self::SEND_RESULT_CORRUPT_INPUT, + self::SEND_RESULT_EMAIL_DISABLED, self::SEND_RESULT_EMAIL_UNCONFIRMED, - self::SEND_RESULT_PREVIOUS_SPAM, - self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_MESSAGE, - self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_PORTAL, + self::SEND_RESULT_GDPR_DOI_ENABLED, + self::SEND_RESULT_GRAYMAIL_SUPPRESSED, + self::SEND_RESULT_HUBL_LIMIT_EXCEEDED, + self::SEND_RESULT_IDEMPOTENT_FAIL, + self::SEND_RESULT_IDEMPOTENT_IGNORE, self::SEND_RESULT_INVALID_FROM_ADDRESS, - self::SEND_RESULT_CAMPAIGN_CANCELLED, - self::SEND_RESULT_VALIDATION_FAILED, + self::SEND_RESULT_INVALID_TO_ADDRESS, + self::SEND_RESULT_LOW_CONTACT_QUALITY_SCORE, + self::SEND_RESULT_MISSING_CONTENT, + self::SEND_RESULT_MISSING_REQUIRED_PARAMETER, + self::SEND_RESULT_MISSING_TEMPLATE_PROPERTIES, self::SEND_RESULT_MTA_IGNORE, - self::SEND_RESULT_BLOCKED_ADDRESS, - self::SEND_RESULT_PORTAL_OVER_LIMIT, + self::SEND_RESULT_NON_MARKETABLE_CONTACT, + self::SEND_RESULT_PORTAL_AUTHENTICATION_FAILURE, self::SEND_RESULT_PORTAL_EXPIRED, self::SEND_RESULT_PORTAL_MISSING_MARKETING_SCOPE, - self::SEND_RESULT_MISSING_TEMPLATE_PROPERTIES, - self::SEND_RESULT_MISSING_REQUIRED_PARAMETER, - self::SEND_RESULT_PORTAL_AUTHENTICATION_FAILURE, - self::SEND_RESULT_MISSING_CONTENT, - self::SEND_RESULT_CORRUPT_INPUT, - self::SEND_RESULT_TEMPLATE_RENDER_EXCEPTION, - self::SEND_RESULT_GRAYMAIL_SUPPRESSED, - self::SEND_RESULT_UNCONFIGURED_SENDING_DOMAIN, - self::SEND_RESULT_UNDELIVERABLE, - self::SEND_RESULT_CANCELLED_ABUSE, - self::SEND_RESULT_QUARANTINED_ADDRESS, - self::SEND_RESULT_ADDRESS_ONLY_ACCEPTED_ON_PROD, self::SEND_RESULT_PORTAL_NOT_AUTHORIZED_FOR_APPLICATION, - self::SEND_RESULT_ADDRESS_LIST_BOMBED, - self::SEND_RESULT_ADDRESS_OPTED_OUT, - self::SEND_RESULT_RECIPIENT_FATIGUE_SUPPRESSED, - self::SEND_RESULT_TOO_MANY_RECIPIENTS, + self::SEND_RESULT_PORTAL_OVER_LIMIT, + self::SEND_RESULT_PORTAL_SUSPENDED, + self::SEND_RESULT_PREVIOUS_SPAM, + self::SEND_RESULT_PREVIOUSLY_BOUNCED, self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_BRAND, - self::SEND_RESULT_NON_MARKETABLE_CONTACT, self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_BUSINESS_UNIT, - self::SEND_RESULT_GDPR_DOI_ENABLED, + self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_MESSAGE, + self::SEND_RESULT_PREVIOUSLY_UNSUBSCRIBED_PORTAL, + self::SEND_RESULT_QUARANTINED_ADDRESS, + self::SEND_RESULT_QUEUED, + self::SEND_RESULT_RECIPIENT_FATIGUE_SUPPRESSED, + self::SEND_RESULT_SENT, + self::SEND_RESULT_TEMPLATE_RENDER_EXCEPTION, + self::SEND_RESULT_THROTTLED, + self::SEND_RESULT_TOO_MANY_RECIPIENTS, + self::SEND_RESULT_UBB_GOVERNANCE_MISSING, + self::SEND_RESULT_UNCONFIGURED_SENDING_DOMAIN, + self::SEND_RESULT_UNDELIVERABLE, + self::SEND_RESULT_VALIDATION_FAILED, ]; } @@ -375,10 +391,10 @@ public function getSendResultAllowableValues() public function getStatusAllowableValues() { return [ - self::STATUS_PENDING, - self::STATUS_PROCESSING, self::STATUS_CANCELED, self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, ]; } @@ -397,13 +413,14 @@ public function getStatusAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('event_id', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); - $this->setIfExists('status_id', $data ?? [], null); - $this->setIfExists('send_result', $data ?? [], null); + $this->setIfExists('event_id', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('send_result', $data ?? [], null); $this->setIfExists('started_at', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('status_id', $data ?? [], null); } /** @@ -433,9 +450,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['status_id'] === null) { - $invalidProperties[] = "'status_id' can't be null"; - } $allowedValues = $this->getSendResultAllowableValues(); if (!is_null($this->container['send_result']) && !in_array($this->container['send_result'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -457,6 +471,9 @@ public function listInvalidProperties() ); } + if ($this->container['status_id'] === null) { + $invalidProperties[] = "'status_id' can't be null"; + } return $invalidProperties; } @@ -472,6 +489,33 @@ public function valid() } + /** + * Gets completed_at + * + * @return \DateTime|null + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime|null $completed_at Time when the send was completed. + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + /** * Gets event_id * @@ -500,55 +544,55 @@ public function setEventId($event_id) } /** - * Gets completed_at + * Gets message * - * @return \DateTime|null + * @return string|null */ - public function getCompletedAt() + public function getMessage() { - return $this->container['completed_at']; + return $this->container['message']; } /** - * Sets completed_at + * Sets message * - * @param \DateTime|null $completed_at Time when the send was completed. + * @param string|null $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setCompletedAt($completed_at) + public function setMessage($message) { - if (is_null($completed_at)) { - throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['completed_at'] = $completed_at; + $this->container['message'] = $message; return $this; } /** - * Gets status_id + * Gets requested_at * - * @return string + * @return \DateTime|null */ - public function getStatusId() + public function getRequestedAt() { - return $this->container['status_id']; + return $this->container['requested_at']; } /** - * Sets status_id + * Sets requested_at * - * @param string $status_id Identifier used to query the status of the send. + * @param \DateTime|null $requested_at Time when the send was requested. * * @return self */ - public function setStatusId($status_id) + public function setRequestedAt($requested_at) { - if (is_null($status_id)) { - throw new \InvalidArgumentException('non-nullable status_id cannot be null'); + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); } - $this->container['status_id'] = $status_id; + $this->container['requested_at'] = $requested_at; return $this; } @@ -590,33 +634,6 @@ public function setSendResult($send_result) return $this; } - /** - * Gets requested_at - * - * @return \DateTime|null - */ - public function getRequestedAt() - { - return $this->container['requested_at']; - } - - /** - * Sets requested_at - * - * @param \DateTime|null $requested_at Time when the send was requested. - * - * @return self - */ - public function setRequestedAt($requested_at) - { - if (is_null($requested_at)) { - throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); - } - $this->container['requested_at'] = $requested_at; - - return $this; - } - /** * Gets started_at * @@ -680,14 +697,41 @@ public function setStatus($status) return $this; } + + /** + * Gets status_id + * + * @return string + */ + public function getStatusId() + { + return $this->container['status_id']; + } + + /** + * Sets status_id + * + * @param string $status_id Identifier used to query the status of the send. + * + * @return self + */ + public function setStatusId($status_id) + { + if (is_null($status_id)) { + throw new \InvalidArgumentException('non-nullable status_id cannot be null'); + } + $this->container['status_id'] = $status_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]); } @@ -695,12 +739,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; } @@ -725,11 +769,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/Marketing/Transactional/Model/Error.php b/codegen/Marketing/Transactional/Model/Error.php index 4be58926..4678b3f2 100644 --- a/codegen/Marketing/Transactional/Model/Error.php +++ b/codegen/Marketing/Transactional/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,13 +57,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\Marketing\Transactional\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Marketing\Transactional\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\Marketing\Transactional\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\Marketing\Transactional\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/Marketing/Transactional/Model/ErrorDetail.php b/codegen/Marketing/Transactional/Model/ErrorDetail.php index a55cc977..f5ce1d14 100644 --- a/codegen/Marketing/Transactional/Model/ErrorDetail.php +++ b/codegen/Marketing/Transactional/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * 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/Marketing/Transactional/Model/EventIdView.php b/codegen/Marketing/Transactional/Model/EventIdView.php index 54006398..d783a09e 100644 --- a/codegen/Marketing/Transactional/Model/EventIdView.php +++ b/codegen/Marketing/Transactional/Model/EventIdView.php @@ -2,7 +2,7 @@ /** * EventIdView * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -359,11 +359,11 @@ public function setId($id) /** * 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]); } @@ -371,12 +371,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; } @@ -401,11 +401,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/Marketing/Transactional/Model/ForwardPaging.php b/codegen/Marketing/Transactional/Model/ForwardPaging.php index ce8a5d9b..b7ebfcf5 100644 --- a/codegen/Marketing/Transactional/Model/ForwardPaging.php +++ b/codegen/Marketing/Transactional/Model/ForwardPaging.php @@ -2,7 +2,7 @@ /** * ForwardPaging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -318,11 +318,11 @@ public function setNext($next) /** * 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]); } @@ -330,12 +330,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; } @@ -360,11 +360,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/Marketing/Transactional/Model/ModelInterface.php b/codegen/Marketing/Transactional/Model/ModelInterface.php index 6fc892d7..ad8ae343 100644 --- a/codegen/Marketing/Transactional/Model/ModelInterface.php +++ b/codegen/Marketing/Transactional/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional\Model @@ -17,7 +17,7 @@ * * 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/Marketing/Transactional/Model/NextPage.php b/codegen/Marketing/Transactional/Model/NextPage.php index 3bc2fb78..42652daf 100644 --- a/codegen/Marketing/Transactional/Model/NextPage.php +++ b/codegen/Marketing/Transactional/Model/NextPage.php @@ -2,7 +2,7 @@ /** * NextPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * NextPage Class Doc Comment * * @category Class + * @description Specifies the paging information needed to retrieve the next set of results in a paginated API response * @package HubSpot\Client\Marketing\Transactional * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,8 +58,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'link' => 'string', - 'after' => 'string' + 'after' => 'string', + 'link' => 'string' ]; /** @@ -69,8 +70,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'link' => null, - 'after' => null + 'after' => null, + 'link' => null ]; /** @@ -79,8 +80,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'link' => false, - 'after' => false + 'after' => false, + 'link' => false ]; /** @@ -169,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'link' => 'link', - 'after' => 'after' + 'after' => 'after', + 'link' => 'link' ]; /** @@ -179,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'link' => 'setLink', - 'after' => 'setAfter' + 'after' => 'setAfter', + 'link' => 'setLink' ]; /** @@ -189,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'link' => 'getLink', - 'after' => 'getAfter' + 'after' => 'getAfter', + 'link' => 'getLink' ]; /** @@ -250,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); } /** @@ -300,66 +301,66 @@ public function valid() /** - * Gets link + * Gets after * - * @return string|null + * @return string */ - public function getLink() + public function getAfter() { - return $this->container['link']; + return $this->container['after']; } /** - * Sets link + * Sets after * - * @param string|null $link + * @param string $after A paging cursor token for retrieving subsequent pages. * * @return self */ - public function setLink($link) + public function setAfter($after) { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); } - $this->container['link'] = $link; + $this->container['after'] = $after; return $this; } /** - * Gets after + * Gets link * - * @return string + * @return string|null */ - public function getAfter() + public function getLink() { - return $this->container['after']; + return $this->container['link']; } /** - * Sets after + * Sets link * - * @param string $after + * @param string|null $link A URL that can be used to retrieve the next page results. * * @return self */ - public function setAfter($after) + public function setLink($link) { - if (is_null($after)) { - throw new \InvalidArgumentException('non-nullable after cannot be null'); + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); } - $this->container['after'] = $after; + $this->container['link'] = $link; 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]); } @@ -367,12 +368,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; } @@ -397,11 +398,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/Marketing/Transactional/Model/PublicSingleSendEmail.php b/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php index 652c9abc..128192a4 100644 --- a/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php +++ b/codegen/Marketing/Transactional/Model/PublicSingleSendEmail.php @@ -2,7 +2,7 @@ /** * PublicSingleSendEmail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,11 +58,11 @@ class PublicSingleSendEmail implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'cc' => 'string[]', - 'send_id' => 'string', 'bcc' => 'string[]', - 'reply_to' => 'string[]', + 'cc' => 'string[]', 'from' => 'string', + 'reply_to' => 'string[]', + 'send_id' => 'string', 'to' => 'string' ]; @@ -74,11 +74,11 @@ class PublicSingleSendEmail implements ModelInterface, ArrayAccess, \JsonSeriali * @psalm-var array */ protected static $openAPIFormats = [ - 'cc' => null, - 'send_id' => null, 'bcc' => null, - 'reply_to' => null, + 'cc' => null, 'from' => null, + 'reply_to' => null, + 'send_id' => null, 'to' => null ]; @@ -88,11 +88,11 @@ class PublicSingleSendEmail implements ModelInterface, ArrayAccess, \JsonSeriali * @var boolean[] */ protected static array $openAPINullables = [ - 'cc' => false, - 'send_id' => false, 'bcc' => false, - 'reply_to' => false, + 'cc' => false, 'from' => false, + 'reply_to' => false, + 'send_id' => false, 'to' => false ]; @@ -182,11 +182,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'cc' => 'cc', - 'send_id' => 'sendId', 'bcc' => 'bcc', - 'reply_to' => 'replyTo', + 'cc' => 'cc', 'from' => 'from', + 'reply_to' => 'replyTo', + 'send_id' => 'sendId', 'to' => 'to' ]; @@ -196,11 +196,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'cc' => 'setCc', - 'send_id' => 'setSendId', 'bcc' => 'setBcc', - 'reply_to' => 'setReplyTo', + 'cc' => 'setCc', 'from' => 'setFrom', + 'reply_to' => 'setReplyTo', + 'send_id' => 'setSendId', 'to' => 'setTo' ]; @@ -210,11 +210,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'cc' => 'getCc', - 'send_id' => 'getSendId', 'bcc' => 'getBcc', - 'reply_to' => 'getReplyTo', + 'cc' => 'getCc', 'from' => 'getFrom', + 'reply_to' => 'getReplyTo', + 'send_id' => 'getSendId', 'to' => 'getTo' ]; @@ -275,11 +275,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('cc', $data ?? [], null); - $this->setIfExists('send_id', $data ?? [], null); $this->setIfExists('bcc', $data ?? [], null); - $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('cc', $data ?? [], null); $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('reply_to', $data ?? [], null); + $this->setIfExists('send_id', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); } @@ -329,82 +329,82 @@ public function valid() /** - * Gets cc + * Gets bcc * * @return string[]|null */ - public function getCc() + public function getBcc() { - return $this->container['cc']; + return $this->container['bcc']; } /** - * Sets cc + * Sets bcc * - * @param string[]|null $cc List of email addresses to send as Cc. + * @param string[]|null $bcc List of email addresses to send as Bcc. * * @return self */ - public function setCc($cc) + public function setBcc($bcc) { - if (is_null($cc)) { - throw new \InvalidArgumentException('non-nullable cc cannot be null'); + if (is_null($bcc)) { + throw new \InvalidArgumentException('non-nullable bcc cannot be null'); } - $this->container['cc'] = $cc; + $this->container['bcc'] = $bcc; return $this; } /** - * Gets send_id + * Gets cc * - * @return string|null + * @return string[]|null */ - public function getSendId() + public function getCc() { - return $this->container['send_id']; + return $this->container['cc']; } /** - * Sets send_id + * Sets cc * - * @param string|null $send_id ID for a particular send. No more than one email will be sent per sendId. + * @param string[]|null $cc List of email addresses to send as Cc. * * @return self */ - public function setSendId($send_id) + public function setCc($cc) { - if (is_null($send_id)) { - throw new \InvalidArgumentException('non-nullable send_id cannot be null'); + if (is_null($cc)) { + throw new \InvalidArgumentException('non-nullable cc cannot be null'); } - $this->container['send_id'] = $send_id; + $this->container['cc'] = $cc; return $this; } /** - * Gets bcc + * Gets from * - * @return string[]|null + * @return string|null */ - public function getBcc() + public function getFrom() { - return $this->container['bcc']; + return $this->container['from']; } /** - * Sets bcc + * Sets from * - * @param string[]|null $bcc List of email addresses to send as Bcc. + * @param string|null $from The From header for the email. * * @return self */ - public function setBcc($bcc) + public function setFrom($from) { - if (is_null($bcc)) { - throw new \InvalidArgumentException('non-nullable bcc cannot be null'); + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); } - $this->container['bcc'] = $bcc; + $this->container['from'] = $from; return $this; } @@ -437,28 +437,28 @@ public function setReplyTo($reply_to) } /** - * Gets from + * Gets send_id * * @return string|null */ - public function getFrom() + public function getSendId() { - return $this->container['from']; + return $this->container['send_id']; } /** - * Sets from + * Sets send_id * - * @param string|null $from The From header for the email. + * @param string|null $send_id ID for a particular send. No more than one email will be sent per sendId. * * @return self */ - public function setFrom($from) + public function setSendId($send_id) { - if (is_null($from)) { - throw new \InvalidArgumentException('non-nullable from cannot be null'); + if (is_null($send_id)) { + throw new \InvalidArgumentException('non-nullable send_id cannot be null'); } - $this->container['from'] = $from; + $this->container['send_id'] = $send_id; return $this; } @@ -492,11 +492,11 @@ public function setTo($to) /** * 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]); } @@ -504,12 +504,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; } @@ -534,11 +534,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/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php b/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php index d3936b27..9b50cfce 100644 --- a/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php +++ b/codegen/Marketing/Transactional/Model/PublicSingleSendRequestEgg.php @@ -2,7 +2,7 @@ /** * PublicSingleSendRequestEgg * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,10 +58,10 @@ class PublicSingleSendRequestEgg implements ModelInterface, ArrayAccess, \JsonSe * @var string[] */ protected static $openAPITypes = [ + 'contact_properties' => 'array', 'custom_properties' => 'array', 'email_id' => 'int', - 'message' => '\HubSpot\Client\Marketing\Transactional\Model\PublicSingleSendEmail', - 'contact_properties' => 'array' + 'message' => '\HubSpot\Client\Marketing\Transactional\Model\PublicSingleSendEmail' ]; /** @@ -72,10 +72,10 @@ class PublicSingleSendRequestEgg implements ModelInterface, ArrayAccess, \JsonSe * @psalm-var array */ protected static $openAPIFormats = [ + 'contact_properties' => null, 'custom_properties' => null, - 'email_id' => 'int32', - 'message' => null, - 'contact_properties' => null + 'email_id' => 'int64', + 'message' => null ]; /** @@ -84,10 +84,10 @@ class PublicSingleSendRequestEgg implements ModelInterface, ArrayAccess, \JsonSe * @var boolean[] */ protected static array $openAPINullables = [ + 'contact_properties' => false, 'custom_properties' => false, 'email_id' => false, - 'message' => false, - 'contact_properties' => false + 'message' => false ]; /** @@ -176,10 +176,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'contact_properties' => 'contactProperties', 'custom_properties' => 'customProperties', 'email_id' => 'emailId', - 'message' => 'message', - 'contact_properties' => 'contactProperties' + 'message' => 'message' ]; /** @@ -188,10 +188,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'contact_properties' => 'setContactProperties', 'custom_properties' => 'setCustomProperties', 'email_id' => 'setEmailId', - 'message' => 'setMessage', - 'contact_properties' => 'setContactProperties' + 'message' => 'setMessage' ]; /** @@ -200,10 +200,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'contact_properties' => 'getContactProperties', 'custom_properties' => 'getCustomProperties', 'email_id' => 'getEmailId', - 'message' => 'getMessage', - 'contact_properties' => 'getContactProperties' + 'message' => 'getMessage' ]; /** @@ -263,10 +263,10 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('contact_properties', $data ?? [], null); $this->setIfExists('custom_properties', $data ?? [], null); $this->setIfExists('email_id', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('contact_properties', $data ?? [], null); } /** @@ -317,6 +317,33 @@ public function valid() } + /** + * Gets contact_properties + * + * @return array|null + */ + public function getContactProperties() + { + return $this->container['contact_properties']; + } + + /** + * Sets contact_properties + * + * @param array|null $contact_properties The contactProperties field is a map of contact property values. Each contact property value contains a name and value property. Each property will get set on the contact record and will be visible in the template under {{ contact.NAME }}. Use these properties when you want to set a contact property while you’re sending the email. For example, when sending a reciept you may want to set a last_paid_date property, as the sending of the receipt will have information about the last payment. + * + * @return self + */ + public function setContactProperties($contact_properties) + { + if (is_null($contact_properties)) { + throw new \InvalidArgumentException('non-nullable contact_properties cannot be null'); + } + $this->container['contact_properties'] = $contact_properties; + + return $this; + } + /** * Gets custom_properties * @@ -397,41 +424,14 @@ public function setMessage($message) return $this; } - - /** - * Gets contact_properties - * - * @return array|null - */ - public function getContactProperties() - { - return $this->container['contact_properties']; - } - - /** - * Sets contact_properties - * - * @param array|null $contact_properties The contactProperties field is a map of contact property values. Each contact property value contains a name and value property. Each property will get set on the contact record and will be visible in the template under {{ contact.NAME }}. Use these properties when you want to set a contact property while you’re sending the email. For example, when sending a reciept you may want to set a last_paid_date property, as the sending of the receipt will have information about the last payment. - * - * @return self - */ - public function setContactProperties($contact_properties) - { - if (is_null($contact_properties)) { - throw new \InvalidArgumentException('non-nullable contact_properties cannot be null'); - } - $this->container['contact_properties'] = $contact_properties; - - 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]); } @@ -439,12 +439,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; } @@ -469,11 +469,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/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php b/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php index 2c8a2070..9af74c73 100644 --- a/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php +++ b/codegen/Marketing/Transactional/Model/SmtpApiTokenRequestEgg.php @@ -2,7 +2,7 @@ /** * SmtpApiTokenRequestEgg * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,8 +58,8 @@ class SmtpApiTokenRequestEgg implements ModelInterface, ArrayAccess, \JsonSerial * @var string[] */ protected static $openAPITypes = [ - 'create_contact' => 'bool', - 'campaign_name' => 'string' + 'campaign_name' => 'string', + 'create_contact' => 'bool' ]; /** @@ -70,8 +70,8 @@ class SmtpApiTokenRequestEgg implements ModelInterface, ArrayAccess, \JsonSerial * @psalm-var array */ protected static $openAPIFormats = [ - 'create_contact' => null, - 'campaign_name' => null + 'campaign_name' => null, + 'create_contact' => null ]; /** @@ -80,8 +80,8 @@ class SmtpApiTokenRequestEgg implements ModelInterface, ArrayAccess, \JsonSerial * @var boolean[] */ protected static array $openAPINullables = [ - 'create_contact' => false, - 'campaign_name' => false + 'campaign_name' => false, + 'create_contact' => false ]; /** @@ -170,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'create_contact' => 'createContact', - 'campaign_name' => 'campaignName' + 'campaign_name' => 'campaignName', + 'create_contact' => 'createContact' ]; /** @@ -180,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'create_contact' => 'setCreateContact', - 'campaign_name' => 'setCampaignName' + 'campaign_name' => 'setCampaignName', + 'create_contact' => 'setCreateContact' ]; /** @@ -190,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'create_contact' => 'getCreateContact', - 'campaign_name' => 'getCampaignName' + 'campaign_name' => 'getCampaignName', + 'create_contact' => 'getCreateContact' ]; /** @@ -251,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('create_contact', $data ?? [], null); $this->setIfExists('campaign_name', $data ?? [], null); + $this->setIfExists('create_contact', $data ?? [], null); } /** @@ -282,12 +282,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['create_contact'] === null) { - $invalidProperties[] = "'create_contact' can't be null"; - } if ($this->container['campaign_name'] === null) { $invalidProperties[] = "'campaign_name' can't be null"; } + if ($this->container['create_contact'] === null) { + $invalidProperties[] = "'create_contact' can't be null"; + } return $invalidProperties; } @@ -304,66 +304,66 @@ public function valid() /** - * Gets create_contact + * Gets campaign_name * - * @return bool + * @return string */ - public function getCreateContact() + public function getCampaignName() { - return $this->container['create_contact']; + return $this->container['campaign_name']; } /** - * Sets create_contact + * Sets campaign_name * - * @param bool $create_contact Indicates whether a contact should be created for email recipients. + * @param string $campaign_name A name for the campaign tied to the SMTP API token. * * @return self */ - public function setCreateContact($create_contact) + public function setCampaignName($campaign_name) { - if (is_null($create_contact)) { - throw new \InvalidArgumentException('non-nullable create_contact cannot be null'); + if (is_null($campaign_name)) { + throw new \InvalidArgumentException('non-nullable campaign_name cannot be null'); } - $this->container['create_contact'] = $create_contact; + $this->container['campaign_name'] = $campaign_name; return $this; } /** - * Gets campaign_name + * Gets create_contact * - * @return string + * @return bool */ - public function getCampaignName() + public function getCreateContact() { - return $this->container['campaign_name']; + return $this->container['create_contact']; } /** - * Sets campaign_name + * Sets create_contact * - * @param string $campaign_name A name for the campaign tied to the SMTP API token. + * @param bool $create_contact Indicates whether a contact should be created for email recipients. * * @return self */ - public function setCampaignName($campaign_name) + public function setCreateContact($create_contact) { - if (is_null($campaign_name)) { - throw new \InvalidArgumentException('non-nullable campaign_name cannot be null'); + if (is_null($create_contact)) { + throw new \InvalidArgumentException('non-nullable create_contact cannot be null'); } - $this->container['campaign_name'] = $campaign_name; + $this->container['create_contact'] = $create_contact; 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]); } @@ -371,12 +371,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; } @@ -401,11 +401,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/Marketing/Transactional/Model/SmtpApiTokenView.php b/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php index 9448e2ae..71d9be98 100644 --- a/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php +++ b/codegen/Marketing/Transactional/Model/SmtpApiTokenView.php @@ -2,7 +2,7 @@ /** * SmtpApiTokenView * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,13 +58,13 @@ class SmtpApiTokenView implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'campaign_name' => 'string', + 'create_contact' => 'bool', 'created_at' => '\DateTime', - 'password' => 'string', 'created_by' => 'string', - 'create_contact' => 'bool', - 'id' => 'string', 'email_campaign_id' => 'string', - 'campaign_name' => 'string' + 'id' => 'string', + 'password' => 'string' ]; /** @@ -75,13 +75,13 @@ class SmtpApiTokenView implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'campaign_name' => null, + 'create_contact' => null, 'created_at' => 'date-time', - 'password' => null, 'created_by' => null, - 'create_contact' => null, - 'id' => null, 'email_campaign_id' => null, - 'campaign_name' => null + 'id' => null, + 'password' => null ]; /** @@ -90,13 +90,13 @@ class SmtpApiTokenView implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'campaign_name' => false, + 'create_contact' => false, 'created_at' => false, - 'password' => false, 'created_by' => false, - 'create_contact' => false, - 'id' => false, 'email_campaign_id' => false, - 'campaign_name' => false + 'id' => false, + 'password' => false ]; /** @@ -185,13 +185,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'campaign_name' => 'campaignName', + 'create_contact' => 'createContact', 'created_at' => 'createdAt', - 'password' => 'password', 'created_by' => 'createdBy', - 'create_contact' => 'createContact', - 'id' => 'id', 'email_campaign_id' => 'emailCampaignId', - 'campaign_name' => 'campaignName' + 'id' => 'id', + 'password' => 'password' ]; /** @@ -200,13 +200,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'campaign_name' => 'setCampaignName', + 'create_contact' => 'setCreateContact', 'created_at' => 'setCreatedAt', - 'password' => 'setPassword', 'created_by' => 'setCreatedBy', - 'create_contact' => 'setCreateContact', - 'id' => 'setId', 'email_campaign_id' => 'setEmailCampaignId', - 'campaign_name' => 'setCampaignName' + 'id' => 'setId', + 'password' => 'setPassword' ]; /** @@ -215,13 +215,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'campaign_name' => 'getCampaignName', + 'create_contact' => 'getCreateContact', 'created_at' => 'getCreatedAt', - 'password' => 'getPassword', 'created_by' => 'getCreatedBy', - 'create_contact' => 'getCreateContact', - 'id' => 'getId', 'email_campaign_id' => 'getEmailCampaignId', - 'campaign_name' => 'getCampaignName' + 'id' => 'getId', + 'password' => 'getPassword' ]; /** @@ -281,13 +281,13 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('campaign_name', $data ?? [], null); + $this->setIfExists('create_contact', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('password', $data ?? [], null); $this->setIfExists('created_by', $data ?? [], null); - $this->setIfExists('create_contact', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); $this->setIfExists('email_campaign_id', $data ?? [], null); - $this->setIfExists('campaign_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); } /** @@ -317,23 +317,23 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['campaign_name'] === null) { + $invalidProperties[] = "'campaign_name' can't be null"; + } + if ($this->container['create_contact'] === null) { + $invalidProperties[] = "'create_contact' can't be null"; + } if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } if ($this->container['created_by'] === null) { $invalidProperties[] = "'created_by' can't be null"; } - if ($this->container['create_contact'] === null) { - $invalidProperties[] = "'create_contact' can't be null"; - } - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } if ($this->container['email_campaign_id'] === null) { $invalidProperties[] = "'email_campaign_id' can't be null"; } - if ($this->container['campaign_name'] === null) { - $invalidProperties[] = "'campaign_name' can't be null"; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; } return $invalidProperties; } @@ -351,201 +351,201 @@ public function valid() /** - * Gets created_at + * Gets campaign_name * - * @return \DateTime + * @return string */ - public function getCreatedAt() + public function getCampaignName() { - return $this->container['created_at']; + return $this->container['campaign_name']; } /** - * Sets created_at + * Sets campaign_name * - * @param \DateTime $created_at Timestamp generated when a token is created. + * @param string $campaign_name A name for the campaign tied to the SMTP API token. * * @return self */ - public function setCreatedAt($created_at) + public function setCampaignName($campaign_name) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($campaign_name)) { + throw new \InvalidArgumentException('non-nullable campaign_name cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['campaign_name'] = $campaign_name; return $this; } /** - * Gets password + * Gets create_contact * - * @return string|null + * @return bool */ - public function getPassword() + public function getCreateContact() { - return $this->container['password']; + return $this->container['create_contact']; } /** - * Sets password + * Sets create_contact * - * @param string|null $password Password used to log into the HubSpot SMTP server. + * @param bool $create_contact Indicates whether a contact should be created for email recipients. * * @return self */ - public function setPassword($password) + public function setCreateContact($create_contact) { - if (is_null($password)) { - throw new \InvalidArgumentException('non-nullable password cannot be null'); + if (is_null($create_contact)) { + throw new \InvalidArgumentException('non-nullable create_contact cannot be null'); } - $this->container['password'] = $password; + $this->container['create_contact'] = $create_contact; return $this; } /** - * Gets created_by + * Gets created_at * - * @return string + * @return \DateTime */ - public function getCreatedBy() + public function getCreatedAt() { - return $this->container['created_by']; + return $this->container['created_at']; } /** - * Sets created_by + * Sets created_at * - * @param string $created_by Email address of the user that sent the token creation request. + * @param \DateTime $created_at Timestamp generated when a token is created. * * @return self */ - public function setCreatedBy($created_by) + public function setCreatedAt($created_at) { - if (is_null($created_by)) { - throw new \InvalidArgumentException('non-nullable created_by cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['created_by'] = $created_by; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets create_contact + * Gets created_by * - * @return bool + * @return string */ - public function getCreateContact() + public function getCreatedBy() { - return $this->container['create_contact']; + return $this->container['created_by']; } /** - * Sets create_contact + * Sets created_by * - * @param bool $create_contact Indicates whether a contact should be created for email recipients. + * @param string $created_by Email address of the user that sent the token creation request. * * @return self */ - public function setCreateContact($create_contact) + public function setCreatedBy($created_by) { - if (is_null($create_contact)) { - throw new \InvalidArgumentException('non-nullable create_contact cannot be null'); + if (is_null($created_by)) { + throw new \InvalidArgumentException('non-nullable created_by cannot be null'); } - $this->container['create_contact'] = $create_contact; + $this->container['created_by'] = $created_by; return $this; } /** - * Gets id + * Gets email_campaign_id * * @return string */ - public function getId() + public function getEmailCampaignId() { - return $this->container['id']; + return $this->container['email_campaign_id']; } /** - * Sets id + * Sets email_campaign_id * - * @param string $id User name to log into the HubSpot SMTP server. + * @param string $email_campaign_id Identifier assigned to the campaign provided in the token creation request. * * @return self */ - public function setId($id) + public function setEmailCampaignId($email_campaign_id) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($email_campaign_id)) { + throw new \InvalidArgumentException('non-nullable email_campaign_id cannot be null'); } - $this->container['id'] = $id; + $this->container['email_campaign_id'] = $email_campaign_id; return $this; } /** - * Gets email_campaign_id + * Gets id * * @return string */ - public function getEmailCampaignId() + public function getId() { - return $this->container['email_campaign_id']; + return $this->container['id']; } /** - * Sets email_campaign_id + * Sets id * - * @param string $email_campaign_id Identifier assigned to the campaign provided in the token creation request. + * @param string $id Identifier of event. * * @return self */ - public function setEmailCampaignId($email_campaign_id) + public function setId($id) { - if (is_null($email_campaign_id)) { - throw new \InvalidArgumentException('non-nullable email_campaign_id cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['email_campaign_id'] = $email_campaign_id; + $this->container['id'] = $id; return $this; } /** - * Gets campaign_name + * Gets password * - * @return string + * @return string|null */ - public function getCampaignName() + public function getPassword() { - return $this->container['campaign_name']; + return $this->container['password']; } /** - * Sets campaign_name + * Sets password * - * @param string $campaign_name A name for the campaign tied to the token. + * @param string|null $password Password used to log into the HubSpot SMTP server. * * @return self */ - public function setCampaignName($campaign_name) + public function setPassword($password) { - if (is_null($campaign_name)) { - throw new \InvalidArgumentException('non-nullable campaign_name cannot be null'); + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); } - $this->container['campaign_name'] = $campaign_name; + $this->container['password'] = $password; 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]); } @@ -553,12 +553,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; } @@ -583,11 +583,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/Marketing/Transactional/ObjectSerializer.php b/codegen/Marketing/Transactional/ObjectSerializer.php index b2a82098..0895455b 100644 --- a/codegen/Marketing/Transactional/ObjectSerializer.php +++ b/codegen/Marketing/Transactional/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Marketing\Transactional @@ -17,7 +17,7 @@ * * 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 e3a29b7199fe84eac9397dabf787a19fec90e645 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Wed, 18 Feb 2026 11:48:47 +0300 Subject: [PATCH 2/2] Marketing Transactional: Update Discovety --- .../Marketing/Transactional/Discovery.php | 17 ++++++++++++----- .../Marketing/Transactional/DiscoverySpec.php | 8 ++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/Discovery/Marketing/Transactional/Discovery.php b/lib/Discovery/Marketing/Transactional/Discovery.php index 332c4e9e..c33b7ad9 100644 --- a/lib/Discovery/Marketing/Transactional/Discovery.php +++ b/lib/Discovery/Marketing/Transactional/Discovery.php @@ -2,12 +2,19 @@ namespace HubSpot\Discovery\Marketing\Transactional; -use HubSpot\Client\Marketing\Transactional\Api\PublicSMTPTokensApi; -use HubSpot\Client\Marketing\Transactional\Api\SingleSendApi; +use HubSpot\Client\Marketing\Transactional\Api\SendTransactionalEmailApi; +use HubSpot\Client\Marketing\Transactional\Api\SMTPTokensApi; use HubSpot\Discovery\DiscoveryBase; +use HubSpot\Client\Marketing\Transactional\Configuration; /** - * @method PublicSMTPTokensApi publicSMTPTokensApi() - * @method SingleSendApi singleSendApi() + * @method SendTransactionalEmailApi sendTransactionalEmailApi() */ -class Discovery extends DiscoveryBase {} +class Discovery extends DiscoveryBase { + public function smtpTokensApi() + { + $config = $this->config->convertToClientConfig(Configuration::class); + + return new SMTPTokensApi($this->client, $config); + } +} diff --git a/tests/spec/Discovery/Marketing/Transactional/DiscoverySpec.php b/tests/spec/Discovery/Marketing/Transactional/DiscoverySpec.php index 46b6cb2e..97a37345 100644 --- a/tests/spec/Discovery/Marketing/Transactional/DiscoverySpec.php +++ b/tests/spec/Discovery/Marketing/Transactional/DiscoverySpec.php @@ -3,8 +3,8 @@ namespace spec\HubSpot\Discovery\Marketing\Transactional; use GuzzleHttp\Client; -use HubSpot\Client\Marketing\Transactional\Api\PublicSMTPTokensApi; -use HubSpot\Client\Marketing\Transactional\Api\SingleSendApi; +use HubSpot\Client\Marketing\Transactional\Api\SendTransactionalEmailApi; +use HubSpot\Client\Marketing\Transactional\Api\SMTPTokensApi; use HubSpot\Config; use HubSpot\Discovery\Marketing\Transactional\Discovery; use PhpSpec\ObjectBehavior; @@ -23,7 +23,7 @@ public function it_is_initializable() public function it_creates_clients() { - $this->publicSMTPTokensApi()->shouldHaveType(PublicSMTPTokensApi::class); - $this->singleSendApi()->shouldHaveType(SingleSendApi::class); + $this->sendTransactionalEmailApi()->shouldHaveType(SendTransactionalEmailApi::class); + $this->smtpTokensApi()->shouldHaveType(SMTPTokensApi::class); } }