From 206fdd7cae9bce0632da24d36fe8772a42cdd32f Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Wed, 28 Feb 2024 16:54:46 +0300 Subject: [PATCH] CRM Objects: Update generator version to 7.3.0. --- codegen/Crm/Objects/Emails/Api/BasicApi.php | 476 ++++++++++++------ codegen/Crm/Objects/Emails/Api/BatchApi.php | 419 ++++++++++----- codegen/Crm/Objects/Emails/Api/GDPRApi.php | 67 +-- .../Objects/Emails/Api/PublicObjectApi.php | 109 ++-- codegen/Crm/Objects/Emails/Api/SearchApi.php | 109 ++-- codegen/Crm/Objects/Emails/ApiException.php | 2 +- codegen/Crm/Objects/Emails/Configuration.php | 41 +- codegen/Crm/Objects/Emails/HeaderSelector.php | 206 ++++++-- .../Crm/Objects/Emails/Model/AssociatedId.php | 99 +++- .../Objects/Emails/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- codegen/Crm/Objects/Emails/Model/Error.php | 129 ++++- .../Crm/Objects/Emails/Model/ErrorDetail.php | 117 ++++- codegen/Crm/Objects/Emails/Model/Filter.php | 117 ++++- .../Crm/Objects/Emails/Model/FilterGroup.php | 93 +++- .../Objects/Emails/Model/ForwardPaging.php | 93 +++- .../Objects/Emails/Model/ModelInterface.php | 18 +- codegen/Crm/Objects/Emails/Model/NextPage.php | 99 +++- codegen/Crm/Objects/Emails/Model/Paging.php | 99 +++- .../Crm/Objects/Emails/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Emails/Model/PublicGdprDeleteInput.php | 99 +++- .../Objects/Emails/Model/PublicMergeInput.php | 99 +++- .../Objects/Emails/Model/PublicObjectId.php | 93 +++- .../Model/PublicObjectSearchRequest.php | 123 ++++- .../Emails/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../Emails/Model/SimplePublicObjectId.php | 93 +++- .../Emails/Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../Objects/Emails/Model/StandardError.php | 135 ++++- .../Emails/Model/ValueWithTimestamp.php | 123 ++++- .../Crm/Objects/Emails/ObjectSerializer.php | 85 +++- codegen/Crm/Objects/Meetings/Api/BasicApi.php | 476 ++++++++++++------ codegen/Crm/Objects/Meetings/Api/BatchApi.php | 419 ++++++++++----- codegen/Crm/Objects/Meetings/Api/GDPRApi.php | 67 +-- .../Objects/Meetings/Api/PublicObjectApi.php | 109 ++-- .../Crm/Objects/Meetings/Api/SearchApi.php | 109 ++-- codegen/Crm/Objects/Meetings/ApiException.php | 2 +- .../Crm/Objects/Meetings/Configuration.php | 41 +- .../Crm/Objects/Meetings/HeaderSelector.php | 206 ++++++-- .../Objects/Meetings/Model/AssociatedId.php | 99 +++- .../Meetings/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- codegen/Crm/Objects/Meetings/Model/Error.php | 129 ++++- .../Objects/Meetings/Model/ErrorDetail.php | 117 ++++- codegen/Crm/Objects/Meetings/Model/Filter.php | 117 ++++- .../Objects/Meetings/Model/FilterGroup.php | 93 +++- .../Objects/Meetings/Model/ForwardPaging.php | 93 +++- .../Objects/Meetings/Model/ModelInterface.php | 18 +- .../Crm/Objects/Meetings/Model/NextPage.php | 99 +++- codegen/Crm/Objects/Meetings/Model/Paging.php | 99 +++- .../Objects/Meetings/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Meetings/Model/PublicGdprDeleteInput.php | 99 +++- .../Meetings/Model/PublicMergeInput.php | 99 +++- .../Objects/Meetings/Model/PublicObjectId.php | 93 +++- .../Model/PublicObjectSearchRequest.php | 123 ++++- .../Meetings/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../Meetings/Model/SimplePublicObjectId.php | 93 +++- .../Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../Objects/Meetings/Model/StandardError.php | 135 ++++- .../Meetings/Model/ValueWithTimestamp.php | 123 ++++- .../Crm/Objects/Meetings/ObjectSerializer.php | 85 +++- codegen/Crm/Objects/Notes/Api/BasicApi.php | 476 ++++++++++++------ codegen/Crm/Objects/Notes/Api/BatchApi.php | 419 ++++++++++----- codegen/Crm/Objects/Notes/Api/GDPRApi.php | 67 +-- .../Crm/Objects/Notes/Api/PublicObjectApi.php | 109 ++-- codegen/Crm/Objects/Notes/Api/SearchApi.php | 109 ++-- codegen/Crm/Objects/Notes/ApiException.php | 2 +- codegen/Crm/Objects/Notes/Configuration.php | 41 +- codegen/Crm/Objects/Notes/HeaderSelector.php | 206 ++++++-- .../Crm/Objects/Notes/Model/AssociatedId.php | 99 +++- .../Objects/Notes/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- codegen/Crm/Objects/Notes/Model/Error.php | 129 ++++- .../Crm/Objects/Notes/Model/ErrorDetail.php | 117 ++++- codegen/Crm/Objects/Notes/Model/Filter.php | 117 ++++- .../Crm/Objects/Notes/Model/FilterGroup.php | 93 +++- .../Crm/Objects/Notes/Model/ForwardPaging.php | 93 +++- .../Objects/Notes/Model/ModelInterface.php | 18 +- codegen/Crm/Objects/Notes/Model/NextPage.php | 99 +++- codegen/Crm/Objects/Notes/Model/Paging.php | 99 +++- .../Crm/Objects/Notes/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Notes/Model/PublicGdprDeleteInput.php | 99 +++- .../Objects/Notes/Model/PublicMergeInput.php | 99 +++- .../Objects/Notes/Model/PublicObjectId.php | 93 +++- .../Notes/Model/PublicObjectSearchRequest.php | 123 ++++- .../Notes/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../Notes/Model/SimplePublicObjectId.php | 93 +++- .../Notes/Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../Crm/Objects/Notes/Model/StandardError.php | 135 ++++- .../Notes/Model/ValueWithTimestamp.php | 123 ++++- .../Crm/Objects/Notes/ObjectSerializer.php | 85 +++- .../Crm/Objects/PostalMail/Api/BasicApi.php | 476 ++++++++++++------ .../Crm/Objects/PostalMail/Api/BatchApi.php | 419 ++++++++++----- .../Crm/Objects/PostalMail/Api/GDPRApi.php | 67 +-- .../PostalMail/Api/PublicObjectApi.php | 109 ++-- .../Crm/Objects/PostalMail/Api/SearchApi.php | 109 ++-- .../Crm/Objects/PostalMail/ApiException.php | 2 +- .../Crm/Objects/PostalMail/Configuration.php | 41 +- .../Crm/Objects/PostalMail/HeaderSelector.php | 206 ++++++-- .../Objects/PostalMail/Model/AssociatedId.php | 99 +++- .../PostalMail/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- .../Crm/Objects/PostalMail/Model/Error.php | 129 ++++- .../Objects/PostalMail/Model/ErrorDetail.php | 117 ++++- .../Crm/Objects/PostalMail/Model/Filter.php | 117 ++++- .../Objects/PostalMail/Model/FilterGroup.php | 93 +++- .../PostalMail/Model/ForwardPaging.php | 93 +++- .../PostalMail/Model/ModelInterface.php | 18 +- .../Crm/Objects/PostalMail/Model/NextPage.php | 99 +++- .../Crm/Objects/PostalMail/Model/Paging.php | 99 +++- .../Objects/PostalMail/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Model/PublicGdprDeleteInput.php | 99 +++- .../PostalMail/Model/PublicMergeInput.php | 99 +++- .../PostalMail/Model/PublicObjectId.php | 93 +++- .../Model/PublicObjectSearchRequest.php | 123 ++++- .../PostalMail/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../PostalMail/Model/SimplePublicObjectId.php | 93 +++- .../Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../PostalMail/Model/StandardError.php | 135 ++++- .../PostalMail/Model/ValueWithTimestamp.php | 123 ++++- .../Objects/PostalMail/ObjectSerializer.php | 85 +++- codegen/Crm/Objects/Tasks/Api/BasicApi.php | 476 ++++++++++++------ codegen/Crm/Objects/Tasks/Api/BatchApi.php | 419 ++++++++++----- codegen/Crm/Objects/Tasks/Api/GDPRApi.php | 67 +-- .../Crm/Objects/Tasks/Api/PublicObjectApi.php | 109 ++-- codegen/Crm/Objects/Tasks/Api/SearchApi.php | 109 ++-- codegen/Crm/Objects/Tasks/ApiException.php | 2 +- codegen/Crm/Objects/Tasks/Configuration.php | 41 +- codegen/Crm/Objects/Tasks/HeaderSelector.php | 206 ++++++-- .../Crm/Objects/Tasks/Model/AssociatedId.php | 99 +++- .../Objects/Tasks/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- codegen/Crm/Objects/Tasks/Model/Error.php | 129 ++++- .../Crm/Objects/Tasks/Model/ErrorDetail.php | 117 ++++- codegen/Crm/Objects/Tasks/Model/Filter.php | 117 ++++- .../Crm/Objects/Tasks/Model/FilterGroup.php | 93 +++- .../Crm/Objects/Tasks/Model/ForwardPaging.php | 93 +++- .../Objects/Tasks/Model/ModelInterface.php | 18 +- codegen/Crm/Objects/Tasks/Model/NextPage.php | 99 +++- codegen/Crm/Objects/Tasks/Model/Paging.php | 99 +++- .../Crm/Objects/Tasks/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Tasks/Model/PublicGdprDeleteInput.php | 99 +++- .../Objects/Tasks/Model/PublicMergeInput.php | 99 +++- .../Objects/Tasks/Model/PublicObjectId.php | 93 +++- .../Tasks/Model/PublicObjectSearchRequest.php | 123 ++++- .../Tasks/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../Tasks/Model/SimplePublicObjectId.php | 93 +++- .../Tasks/Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../Crm/Objects/Tasks/Model/StandardError.php | 135 ++++- .../Tasks/Model/ValueWithTimestamp.php | 123 ++++- .../Crm/Objects/Tasks/ObjectSerializer.php | 85 +++- codegen/Crm/Objects/Taxes/Api/BasicApi.php | 476 ++++++++++++------ codegen/Crm/Objects/Taxes/Api/BatchApi.php | 419 ++++++++++----- codegen/Crm/Objects/Taxes/Api/GDPRApi.php | 67 +-- .../Crm/Objects/Taxes/Api/PublicObjectApi.php | 109 ++-- codegen/Crm/Objects/Taxes/Api/SearchApi.php | 109 ++-- codegen/Crm/Objects/Taxes/ApiException.php | 2 +- codegen/Crm/Objects/Taxes/Configuration.php | 41 +- codegen/Crm/Objects/Taxes/HeaderSelector.php | 206 ++++++-- .../Crm/Objects/Taxes/Model/AssociatedId.php | 99 +++- .../Objects/Taxes/Model/AssociationSpec.php | 99 +++- ...BatchInputSimplePublicObjectBatchInput.php | 93 +++- .../Model/BatchInputSimplePublicObjectId.php | 93 +++- ...hInputSimplePublicObjectInputForCreate.php | 93 +++- .../BatchReadInputSimplePublicObjectId.php | 111 +++- .../Model/BatchResponseSimplePublicObject.php | 123 ++++- ...chResponseSimplePublicObjectWithErrors.php | 135 ++++- .../Model/CollectionResponseAssociatedId.php | 99 +++- ...licObjectWithAssociationsForwardPaging.php | 99 +++- ...thTotalSimplePublicObjectForwardPaging.php | 105 +++- codegen/Crm/Objects/Taxes/Model/Error.php | 129 ++++- .../Crm/Objects/Taxes/Model/ErrorDetail.php | 117 ++++- codegen/Crm/Objects/Taxes/Model/Filter.php | 117 ++++- .../Crm/Objects/Taxes/Model/FilterGroup.php | 93 +++- .../Crm/Objects/Taxes/Model/ForwardPaging.php | 93 +++- .../Objects/Taxes/Model/ModelInterface.php | 18 +- codegen/Crm/Objects/Taxes/Model/NextPage.php | 99 +++- codegen/Crm/Objects/Taxes/Model/Paging.php | 99 +++- .../Crm/Objects/Taxes/Model/PreviousPage.php | 99 +++- .../Model/PublicAssociationsForObject.php | 99 +++- .../Taxes/Model/PublicGdprDeleteInput.php | 99 +++- .../Objects/Taxes/Model/PublicMergeInput.php | 99 +++- .../Objects/Taxes/Model/PublicObjectId.php | 93 +++- .../Taxes/Model/PublicObjectSearchRequest.php | 123 ++++- .../Taxes/Model/SimplePublicObject.php | 129 ++++- .../Model/SimplePublicObjectBatchInput.php | 105 +++- .../Taxes/Model/SimplePublicObjectId.php | 93 +++- .../Taxes/Model/SimplePublicObjectInput.php | 93 +++- .../SimplePublicObjectInputForCreate.php | 99 +++- .../SimplePublicObjectWithAssociations.php | 135 ++++- .../Crm/Objects/Taxes/Model/StandardError.php | 135 ++++- .../Taxes/Model/ValueWithTimestamp.php | 123 ++++- .../Crm/Objects/Taxes/ObjectSerializer.php | 85 +++- 252 files changed, 26394 insertions(+), 3318 deletions(-) diff --git a/codegen/Crm/Objects/Emails/Api/BasicApi.php b/codegen/Crm/Objects/Emails/Api/BasicApi.php index 7964f066c..88007ede2 100644 --- a/codegen/Crm/Objects/Emails/Api/BasicApi.php +++ b/codegen/Crm/Objects/Emails/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $email_id email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($email_id) + public function archive($email_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($email_id); + $this->archiveWithHttpInfo($email_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($email_id) * Archive * * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($email_id) + public function archiveWithHttpInfo($email_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($email_id); + $request = $this->archiveRequest($email_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($email_id) * Archive * * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($email_id) + public function archiveAsync($email_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($email_id) + return $this->archiveAsyncWithHttpInfo($email_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($email_id) + public function archiveAsyncWithHttpInfo($email_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($email_id); + $request = $this->archiveRequest($email_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $email_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($email_id) + public function archiveRequest($email_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'email_id' is set if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($email_id) ); } + $resourcePath = '/crm/v3/objects/emails/{emailId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($email_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($email_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($email_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($email_id) * Create * * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/emails'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function getById($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($email_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($email_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($email_id, $properties = null, $properties_with_history * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($email_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($email_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($email_id, $properties = null, $properties_w * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($email_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($email_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($email_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($email_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($email_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'email_id' is set if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h ); } + + + + + + $resourcePath = '/crm/v3/objects/emails/{emailId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($email_id, $properties = null, $properties_with_h * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/emails'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $email_id email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function update($email_id, $simple_public_object_input, $id_property = null) + public function update($email_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($email_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($email_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($email_id, $simple_public_object_input, $id_property = nu * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($email_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($email_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($email_id, $simple_public_object_input, $id_p * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($email_id, $simple_public_object_input, $id_property = null) + public function updateAsync($email_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($email_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($email_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($email_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($email_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject'; - $request = $this->updateRequest($email_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($email_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $email_id (required) * @param \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($email_id, $simple_public_object_input, $id_property = null) + public function updateRequest($email_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'email_id' is set if ($email_id === null || (is_array($email_id) && count($email_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $email_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper ); } + + $resourcePath = '/crm/v3/objects/emails/{emailId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($email_id, $simple_public_object_input, $id_proper $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Emails/Api/BatchApi.php b/codegen/Crm/Objects/Emails/Api/BatchApi.php index d50cc2dfd..b23a4839c 100644 --- a/codegen/Crm/Objects/Emails/Api/BatchApi.php +++ b/codegen/Crm/Objects/Emails/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of emails by ID * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of emails by ID * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of emails by ID * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of emails by ID * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/emails/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/emails/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/emails/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of emails * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/emails/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Emails/Api/GDPRApi.php b/codegen/Crm/Objects/Emails/Api/GDPRApi.php index 7f863923d..4a66b1db4 100644 --- a/codegen/Crm/Objects/Emails/Api/GDPRApi.php +++ b/codegen/Crm/Objects/Emails/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/emails/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Emails/Api/PublicObjectApi.php b/codegen/Crm/Objects/Emails/Api/PublicObjectApi.php index 429a83ad6..70fa85f11 100644 --- a/codegen/Crm/Objects/Emails/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/Emails/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two emails with same type * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two emails with same type * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two emails with same type * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two emails with same type * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/emails/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Emails/Api/SearchApi.php b/codegen/Crm/Objects/Emails/Api/SearchApi.php index ed14eff29..4a3e33d9d 100644 --- a/codegen/Crm/Objects/Emails/Api/SearchApi.php +++ b/codegen/Crm/Objects/Emails/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Emails\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Emails\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Emails\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Emails\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\Emails\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/emails/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Emails/ApiException.php b/codegen/Crm/Objects/Emails/ApiException.php index c953c9b95..c9a93fa20 100644 --- a/codegen/Crm/Objects/Emails/ApiException.php +++ b/codegen/Crm/Objects/Emails/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/Emails/Configuration.php b/codegen/Crm/Objects/Emails/Configuration.php index 8ccd73327..7d1e4d86d 100644 --- a/codegen/Crm/Objects/Emails/Configuration.php +++ b/codegen/Crm/Objects/Emails/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/Emails/HeaderSelector.php b/codegen/Crm/Objects/Emails/HeaderSelector.php index bb4d3448c..403718d8c 100644 --- a/codegen/Crm/Objects/Emails/HeaderSelector.php +++ b/codegen/Crm/Objects/Emails/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/Emails/Model/AssociatedId.php b/codegen/Crm/Objects/Emails/Model/AssociatedId.php index 61858ef74..43fe80b6a 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Emails/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php index 46e4d8a05..70eae8f9d 100644 --- a/codegen/Crm/Objects/Emails/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Emails/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php index 5d830dcf4..651976914 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php index 53ea9b3a4..de72387e6 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php index 590a215c6..8162d22d7 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php index 2ef219b1d..950eaa0c9 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php index 2a9ef0cd4..65a4e57a1 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php index e339f8564..47b085d3a 100644 --- a/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Emails/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php index e377e0865..592640366 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 472395e42..514819b2b 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 2dde787ee..5915b8f22 100644 --- a/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/Error.php b/codegen/Crm/Objects/Emails/Model/Error.php index d84d17238..bf4130afc 100644 --- a/codegen/Crm/Objects/Emails/Model/Error.php +++ b/codegen/Crm/Objects/Emails/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/ErrorDetail.php b/codegen/Crm/Objects/Emails/Model/ErrorDetail.php index 776dc3ca4..0c302d891 100644 --- a/codegen/Crm/Objects/Emails/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Emails/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/Filter.php b/codegen/Crm/Objects/Emails/Model/Filter.php index 793031baf..4c93fd126 100644 --- a/codegen/Crm/Objects/Emails/Model/Filter.php +++ b/codegen/Crm/Objects/Emails/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Emails/Model/FilterGroup.php b/codegen/Crm/Objects/Emails/Model/FilterGroup.php index 8bac683b6..2cf429b72 100644 --- a/codegen/Crm/Objects/Emails/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Emails/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/ForwardPaging.php b/codegen/Crm/Objects/Emails/Model/ForwardPaging.php index 2f9818851..d6b1ba1b7 100644 --- a/codegen/Crm/Objects/Emails/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Emails/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/ModelInterface.php b/codegen/Crm/Objects/Emails/Model/ModelInterface.php index afe8e3f7b..c275705c2 100644 --- a/codegen/Crm/Objects/Emails/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Emails/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/Emails/Model/NextPage.php b/codegen/Crm/Objects/Emails/Model/NextPage.php index 9a5343602..d1d635ed0 100644 --- a/codegen/Crm/Objects/Emails/Model/NextPage.php +++ b/codegen/Crm/Objects/Emails/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/Paging.php b/codegen/Crm/Objects/Emails/Model/Paging.php index bb9a43a70..4bb169d1e 100644 --- a/codegen/Crm/Objects/Emails/Model/Paging.php +++ b/codegen/Crm/Objects/Emails/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PreviousPage.php b/codegen/Crm/Objects/Emails/Model/PreviousPage.php index 10d1603f2..249006f7e 100644 --- a/codegen/Crm/Objects/Emails/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Emails/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php index f2fcfc232..98baafe99 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Emails/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/Emails/Model/PublicGdprDeleteInput.php index c78951c37..6fd5443c6 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/Emails/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PublicMergeInput.php b/codegen/Crm/Objects/Emails/Model/PublicMergeInput.php index b13b28b51..a7e00bb6d 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/Emails/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PublicObjectId.php b/codegen/Crm/Objects/Emails/Model/PublicObjectId.php index efffd8f47..dc2f261e6 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php index 20dbe60ba..ab6b09424 100644 --- a/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Emails/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php index a170fe9c2..74b5e79d5 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php index 77293d847..4c92b5472 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php index afecf6a8d..ac74659a9 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php index ce074979b..2f0b40202 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php index 77d4fc498..d1d55fec6 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php index 8cd317a48..22d7318ed 100644 --- a/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Emails/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/StandardError.php b/codegen/Crm/Objects/Emails/Model/StandardError.php index 97c610655..245c6d054 100644 --- a/codegen/Crm/Objects/Emails/Model/StandardError.php +++ b/codegen/Crm/Objects/Emails/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php index cc7513374..e5b6e6b31 100644 --- a/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Emails/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/Emails/ObjectSerializer.php b/codegen/Crm/Objects/Emails/ObjectSerializer.php index c9b33427f..8b8f00588 100644 --- a/codegen/Crm/Objects/Emails/ObjectSerializer.php +++ b/codegen/Crm/Objects/Emails/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } diff --git a/codegen/Crm/Objects/Meetings/Api/BasicApi.php b/codegen/Crm/Objects/Meetings/Api/BasicApi.php index 645027af6..4a1d4a27d 100644 --- a/codegen/Crm/Objects/Meetings/Api/BasicApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $meeting_id meeting_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($meeting_id) + public function archive($meeting_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($meeting_id); + $this->archiveWithHttpInfo($meeting_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($meeting_id) * Archive * * @param string $meeting_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($meeting_id) + public function archiveWithHttpInfo($meeting_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($meeting_id); + $request = $this->archiveRequest($meeting_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($meeting_id) * Archive * * @param string $meeting_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($meeting_id) + public function archiveAsync($meeting_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($meeting_id) + return $this->archiveAsyncWithHttpInfo($meeting_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $meeting_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($meeting_id) + public function archiveAsyncWithHttpInfo($meeting_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($meeting_id); + $request = $this->archiveRequest($meeting_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $meeting_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($meeting_id) + public function archiveRequest($meeting_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'meeting_id' is set if ($meeting_id === null || (is_array($meeting_id) && count($meeting_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($meeting_id) ); } + $resourcePath = '/crm/v3/objects/meetings/{meetingId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($meeting_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($meeting_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($meeting_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($meeting_id) * Create * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/meetings'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function getById($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($meeting_id, $properties = null, $properties_with_histor * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($meeting_id, $properties = null, $properties * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($meeting_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($meeting_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'meeting_id' is set if ($meeting_id === null || (is_array($meeting_id) && count($meeting_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with ); } + + + + + + $resourcePath = '/crm/v3/objects/meetings/{meetingId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($meeting_id, $properties = null, $properties_with * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/meetings'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $meeting_id meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function update($meeting_id, $simple_public_object_input, $id_property = null) + public function update($meeting_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($meeting_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($meeting_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($meeting_id, $simple_public_object_input, $id_property = * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($meeting_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($meeting_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($meeting_id, $simple_public_object_input, $id * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($meeting_id, $simple_public_object_input, $id_property = null) + public function updateAsync($meeting_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($meeting_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($meeting_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($meeting_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($meeting_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject'; - $request = $this->updateRequest($meeting_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($meeting_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $meeting_id (required) * @param \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($meeting_id, $simple_public_object_input, $id_property = null) + public function updateRequest($meeting_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'meeting_id' is set if ($meeting_id === null || (is_array($meeting_id) && count($meeting_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $meeting_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop ); } + + $resourcePath = '/crm/v3/objects/meetings/{meetingId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($meeting_id, $simple_public_object_input, $id_prop $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Meetings/Api/BatchApi.php b/codegen/Crm/Objects/Meetings/Api/BatchApi.php index 5e2c63661..bd5eb45bc 100644 --- a/codegen/Crm/Objects/Meetings/Api/BatchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of meetings by ID * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of meetings by ID * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of meetings by ID * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of meetings by ID * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/meetings/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/meetings/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/meetings/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of meetings * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/meetings/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Meetings/Api/GDPRApi.php b/codegen/Crm/Objects/Meetings/Api/GDPRApi.php index 053bc2d9b..3f2be3e98 100644 --- a/codegen/Crm/Objects/Meetings/Api/GDPRApi.php +++ b/codegen/Crm/Objects/Meetings/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/meetings/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Meetings/Api/PublicObjectApi.php b/codegen/Crm/Objects/Meetings/Api/PublicObjectApi.php index 914c94ae1..516439c45 100644 --- a/codegen/Crm/Objects/Meetings/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/Meetings/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two meetings with same type * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two meetings with same type * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two meetings with same type * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two meetings with same type * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/meetings/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Meetings/Api/SearchApi.php b/codegen/Crm/Objects/Meetings/Api/SearchApi.php index a24174b38..c45174554 100644 --- a/codegen/Crm/Objects/Meetings/Api/SearchApi.php +++ b/codegen/Crm/Objects/Meetings/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Meetings\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Meetings\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Meetings\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Meetings\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\Meetings\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/meetings/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Meetings/ApiException.php b/codegen/Crm/Objects/Meetings/ApiException.php index c780bd4aa..9302b4e13 100644 --- a/codegen/Crm/Objects/Meetings/ApiException.php +++ b/codegen/Crm/Objects/Meetings/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/Meetings/Configuration.php b/codegen/Crm/Objects/Meetings/Configuration.php index eeaa06ec2..296b091f2 100644 --- a/codegen/Crm/Objects/Meetings/Configuration.php +++ b/codegen/Crm/Objects/Meetings/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/Meetings/HeaderSelector.php b/codegen/Crm/Objects/Meetings/HeaderSelector.php index 76c7a0ce2..066c235a3 100644 --- a/codegen/Crm/Objects/Meetings/HeaderSelector.php +++ b/codegen/Crm/Objects/Meetings/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php index e537622a0..32f5d0b94 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php index 2068fc841..f1ea92ae0 100644 --- a/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Meetings/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php index bd61fdb8e..66c6c8cf9 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php index cb77da648..e75de2e4c 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php index 442fd6717..9728674e4 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php index 2f34e3626..e6b8ff2df 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php index 97bb77089..f2769e0e6 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php index 06449a344..5c31780bc 100644 --- a/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Meetings/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php index 40316f597..8998739ff 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 762deae6c..71c139c5a 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 43d7adcd4..affcd7c33 100644 --- a/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/Error.php b/codegen/Crm/Objects/Meetings/Model/Error.php index e2ac006d1..81a18ef55 100644 --- a/codegen/Crm/Objects/Meetings/Model/Error.php +++ b/codegen/Crm/Objects/Meetings/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php b/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php index 04a76b1de..09b56763e 100644 --- a/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Meetings/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/Filter.php b/codegen/Crm/Objects/Meetings/Model/Filter.php index ac44f5cdc..60d066f72 100644 --- a/codegen/Crm/Objects/Meetings/Model/Filter.php +++ b/codegen/Crm/Objects/Meetings/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Meetings/Model/FilterGroup.php b/codegen/Crm/Objects/Meetings/Model/FilterGroup.php index e9302a38f..2e4b9d876 100644 --- a/codegen/Crm/Objects/Meetings/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Meetings/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php b/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php index cbac17755..f8f4bfc72 100644 --- a/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Meetings/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/ModelInterface.php b/codegen/Crm/Objects/Meetings/Model/ModelInterface.php index 5c52ed563..3449cd8ae 100644 --- a/codegen/Crm/Objects/Meetings/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Meetings/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/Meetings/Model/NextPage.php b/codegen/Crm/Objects/Meetings/Model/NextPage.php index dd997104e..ef136e462 100644 --- a/codegen/Crm/Objects/Meetings/Model/NextPage.php +++ b/codegen/Crm/Objects/Meetings/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/Paging.php b/codegen/Crm/Objects/Meetings/Model/Paging.php index 938cf0079..854328037 100644 --- a/codegen/Crm/Objects/Meetings/Model/Paging.php +++ b/codegen/Crm/Objects/Meetings/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PreviousPage.php b/codegen/Crm/Objects/Meetings/Model/PreviousPage.php index 23c500d2d..a0eb8abff 100644 --- a/codegen/Crm/Objects/Meetings/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Meetings/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php index ac91bfd37..b7255a224 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/Meetings/Model/PublicGdprDeleteInput.php index 75303309d..0385b08db 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PublicMergeInput.php b/codegen/Crm/Objects/Meetings/Model/PublicMergeInput.php index 6fc7bdb34..8637be418 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php index 3c2cc8d88..a1cfcfbd5 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php index 4b3990099..4af54a81b 100644 --- a/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Meetings/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php index 6abb12f13..4c6cf235e 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php index 523226c6c..d10edc40e 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php index 66e8c3917..6653b9283 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php index 59c09bc9a..d98a78195 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php index 3eb4bdb50..a1d3db92f 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php index 916d4951f..15cda13bf 100644 --- a/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Meetings/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/StandardError.php b/codegen/Crm/Objects/Meetings/Model/StandardError.php index 1b9b7c16a..f94b6fb6a 100644 --- a/codegen/Crm/Objects/Meetings/Model/StandardError.php +++ b/codegen/Crm/Objects/Meetings/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php index 8ae6005c3..d1eeb9060 100644 --- a/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Meetings/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/Meetings/ObjectSerializer.php b/codegen/Crm/Objects/Meetings/ObjectSerializer.php index 39948405a..f54023b54 100644 --- a/codegen/Crm/Objects/Meetings/ObjectSerializer.php +++ b/codegen/Crm/Objects/Meetings/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } diff --git a/codegen/Crm/Objects/Notes/Api/BasicApi.php b/codegen/Crm/Objects/Notes/Api/BasicApi.php index 039585329..b66384916 100644 --- a/codegen/Crm/Objects/Notes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Notes/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $note_id note_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($note_id) + public function archive($note_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($note_id); + $this->archiveWithHttpInfo($note_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($note_id) * Archive * * @param string $note_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($note_id) + public function archiveWithHttpInfo($note_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($note_id); + $request = $this->archiveRequest($note_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($note_id) * Archive * * @param string $note_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($note_id) + public function archiveAsync($note_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($note_id) + return $this->archiveAsyncWithHttpInfo($note_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $note_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($note_id) + public function archiveAsyncWithHttpInfo($note_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($note_id); + $request = $this->archiveRequest($note_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $note_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($note_id) + public function archiveRequest($note_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($note_id) ); } + $resourcePath = '/crm/v3/objects/notes/{noteId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($note_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($note_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($note_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($note_id) * Create * * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/notes'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function getById($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($note_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($note_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($note_id, $properties = null, $properties_with_history = * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($note_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($note_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($note_id, $properties = null, $properties_wi * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($note_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($note_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($note_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($note_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($note_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi ); } + + + + + + $resourcePath = '/crm/v3/objects/notes/{noteId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($note_id, $properties = null, $properties_with_hi * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/notes'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $note_id note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function update($note_id, $simple_public_object_input, $id_property = null) + public function update($note_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($note_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($note_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($note_id, $simple_public_object_input, $id_property = nul * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($note_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($note_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($note_id, $simple_public_object_input, $id_pr * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($note_id, $simple_public_object_input, $id_property = null) + public function updateAsync($note_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($note_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($note_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($note_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($note_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject'; - $request = $this->updateRequest($note_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($note_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $note_id (required) * @param \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($note_id, $simple_public_object_input, $id_property = null) + public function updateRequest($note_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'note_id' is set if ($note_id === null || (is_array($note_id) && count($note_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $note_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert ); } + + $resourcePath = '/crm/v3/objects/notes/{noteId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($note_id, $simple_public_object_input, $id_propert $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Notes/Api/BatchApi.php b/codegen/Crm/Objects/Notes/Api/BatchApi.php index dba5f312f..7d60e755a 100644 --- a/codegen/Crm/Objects/Notes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Notes/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of notes by ID * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of notes by ID * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of notes by ID * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of notes by ID * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/notes/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/notes/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/notes/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of notes * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/notes/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Notes/Api/GDPRApi.php b/codegen/Crm/Objects/Notes/Api/GDPRApi.php index fc9edb915..9d141a3b1 100644 --- a/codegen/Crm/Objects/Notes/Api/GDPRApi.php +++ b/codegen/Crm/Objects/Notes/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/notes/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Notes/Api/PublicObjectApi.php b/codegen/Crm/Objects/Notes/Api/PublicObjectApi.php index d028a3d23..1d79421f4 100644 --- a/codegen/Crm/Objects/Notes/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/Notes/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two notes with same type * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two notes with same type * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two notes with same type * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two notes with same type * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/notes/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Notes/Api/SearchApi.php b/codegen/Crm/Objects/Notes/Api/SearchApi.php index 643462864..eeab284d3 100644 --- a/codegen/Crm/Objects/Notes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Notes/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Notes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Notes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Notes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Notes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\Notes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/notes/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Notes/ApiException.php b/codegen/Crm/Objects/Notes/ApiException.php index 1b6cd05ce..bb51660bb 100644 --- a/codegen/Crm/Objects/Notes/ApiException.php +++ b/codegen/Crm/Objects/Notes/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/Notes/Configuration.php b/codegen/Crm/Objects/Notes/Configuration.php index edfef9170..04b219e67 100644 --- a/codegen/Crm/Objects/Notes/Configuration.php +++ b/codegen/Crm/Objects/Notes/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/Notes/HeaderSelector.php b/codegen/Crm/Objects/Notes/HeaderSelector.php index cefde3d36..52af1b7eb 100644 --- a/codegen/Crm/Objects/Notes/HeaderSelector.php +++ b/codegen/Crm/Objects/Notes/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/Notes/Model/AssociatedId.php b/codegen/Crm/Objects/Notes/Model/AssociatedId.php index 3bc438cc7..d79ce0c26 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Notes/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php index 42543e84e..5e1629acf 100644 --- a/codegen/Crm/Objects/Notes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Notes/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php index b6fd7e9c9..514c15727 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php index 867835175..dcb1395a3 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php index 48fce6f37..d949b7ddc 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php index c0e5a5d41..6f2c1e375 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php index 4c96d12b5..a3f999852 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php index dcdc9bee8..aed9ac0bd 100644 --- a/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Notes/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php index ed366ee9f..7cdd8b2d7 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index c62a18cdd..626d22474 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index a3586ed0c..a3f93b755 100644 --- a/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/Error.php b/codegen/Crm/Objects/Notes/Model/Error.php index 4476975ba..28d02e5cb 100644 --- a/codegen/Crm/Objects/Notes/Model/Error.php +++ b/codegen/Crm/Objects/Notes/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/ErrorDetail.php b/codegen/Crm/Objects/Notes/Model/ErrorDetail.php index 1c9395fa5..0402a63ce 100644 --- a/codegen/Crm/Objects/Notes/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Notes/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/Filter.php b/codegen/Crm/Objects/Notes/Model/Filter.php index 95dfbbccb..e206cb7db 100644 --- a/codegen/Crm/Objects/Notes/Model/Filter.php +++ b/codegen/Crm/Objects/Notes/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Notes/Model/FilterGroup.php b/codegen/Crm/Objects/Notes/Model/FilterGroup.php index 87f7750ae..0f4166b64 100644 --- a/codegen/Crm/Objects/Notes/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Notes/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/ForwardPaging.php b/codegen/Crm/Objects/Notes/Model/ForwardPaging.php index 0b57c263c..b7b70f41c 100644 --- a/codegen/Crm/Objects/Notes/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Notes/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/ModelInterface.php b/codegen/Crm/Objects/Notes/Model/ModelInterface.php index b4b053bc2..a4b25dc37 100644 --- a/codegen/Crm/Objects/Notes/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Notes/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/Notes/Model/NextPage.php b/codegen/Crm/Objects/Notes/Model/NextPage.php index 965a3d935..5db1f77c3 100644 --- a/codegen/Crm/Objects/Notes/Model/NextPage.php +++ b/codegen/Crm/Objects/Notes/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/Paging.php b/codegen/Crm/Objects/Notes/Model/Paging.php index 954c85864..8a99725da 100644 --- a/codegen/Crm/Objects/Notes/Model/Paging.php +++ b/codegen/Crm/Objects/Notes/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PreviousPage.php b/codegen/Crm/Objects/Notes/Model/PreviousPage.php index 02f690b2f..41fe02f9d 100644 --- a/codegen/Crm/Objects/Notes/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Notes/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php index c85a866c1..d2bb5a7d0 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Notes/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/Notes/Model/PublicGdprDeleteInput.php index b30eccb43..1b09a7c2d 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/Notes/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PublicMergeInput.php b/codegen/Crm/Objects/Notes/Model/PublicMergeInput.php index e433a6171..a21a6c1c7 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/Notes/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PublicObjectId.php b/codegen/Crm/Objects/Notes/Model/PublicObjectId.php index cb017fafc..016f47c16 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php index 22d7766c5..ba63dbfa8 100644 --- a/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Notes/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php index 70e96aff8..1b1b45a22 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php index f795898d3..ce5c61c4d 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php index 8f6ad8e24..b6cd476c0 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php index 7d9522471..6c1e18eec 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php index 558ac7887..ff1e0a7c9 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php index 7a03eff10..ea8791f10 100644 --- a/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Notes/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/StandardError.php b/codegen/Crm/Objects/Notes/Model/StandardError.php index 86177e659..06e033394 100644 --- a/codegen/Crm/Objects/Notes/Model/StandardError.php +++ b/codegen/Crm/Objects/Notes/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php index d614e3115..0db389c6c 100644 --- a/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Notes/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/Notes/ObjectSerializer.php b/codegen/Crm/Objects/Notes/ObjectSerializer.php index 3bb4b1c09..1320fe46e 100644 --- a/codegen/Crm/Objects/Notes/ObjectSerializer.php +++ b/codegen/Crm/Objects/Notes/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } diff --git a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php index 455798155..67775cd40 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BasicApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $postal_mail_id postal_mail_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($postal_mail_id) + public function archive($postal_mail_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($postal_mail_id); + $this->archiveWithHttpInfo($postal_mail_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($postal_mail_id) * Archive * * @param string $postal_mail_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($postal_mail_id) + public function archiveWithHttpInfo($postal_mail_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($postal_mail_id); + $request = $this->archiveRequest($postal_mail_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($postal_mail_id) * Archive * * @param string $postal_mail_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($postal_mail_id) + public function archiveAsync($postal_mail_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($postal_mail_id) + return $this->archiveAsyncWithHttpInfo($postal_mail_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $postal_mail_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($postal_mail_id) + public function archiveAsyncWithHttpInfo($postal_mail_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($postal_mail_id); + $request = $this->archiveRequest($postal_mail_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $postal_mail_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($postal_mail_id) + public function archiveRequest($postal_mail_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'postal_mail_id' is set if ($postal_mail_id === null || (is_array($postal_mail_id) && count($postal_mail_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($postal_mail_id) ); } + $resourcePath = '/crm/v3/objects/postal_mail/{postalMailId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($postal_mail_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($postal_mail_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($postal_mail_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($postal_mail_id) * Create * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/postal_mail'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function getById($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($postal_mail_id, $properties = null, $properties_with_hi * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($postal_mail_id, $properties = null, $proper * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($postal_mail_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($postal_mail_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'postal_mail_id' is set if ($postal_mail_id === null || (is_array($postal_mail_id) && count($postal_mail_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ ); } + + + + + + $resourcePath = '/crm/v3/objects/postal_mail/{postalMailId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($postal_mail_id, $properties = null, $properties_ * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/postal_mail'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $postal_mail_id postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function update($postal_mail_id, $simple_public_object_input, $id_property = null) + public function update($postal_mail_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($postal_mail_id, $simple_public_object_input, $id_propert * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($postal_mail_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($postal_mail_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($postal_mail_id, $simple_public_object_input, * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($postal_mail_id, $simple_public_object_input, $id_property = null) + public function updateAsync($postal_mail_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($postal_mail_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; - $request = $this->updateRequest($postal_mail_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($postal_mail_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $postal_mail_id (required) * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($postal_mail_id, $simple_public_object_input, $id_property = null) + public function updateRequest($postal_mail_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'postal_mail_id' is set if ($postal_mail_id === null || (is_array($postal_mail_id) && count($postal_mail_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $postal_mail_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ ); } + + $resourcePath = '/crm/v3/objects/postal_mail/{postalMailId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($postal_mail_id, $simple_public_object_input, $id_ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php index dad30c8bd..dc2419354 100644 --- a/codegen/Crm/Objects/PostalMail/Api/BatchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of postal mail by ID * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of postal mail by ID * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of postal mail by ID * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of postal mail by ID * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/postal_mail/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/postal_mail/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/postal_mail/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of postal mail * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/postal_mail/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/PostalMail/Api/GDPRApi.php b/codegen/Crm/Objects/PostalMail/Api/GDPRApi.php index fb2f58b8a..316770933 100644 --- a/codegen/Crm/Objects/PostalMail/Api/GDPRApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/postal_mail/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php b/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php index 933312cae..5d3d89cd4 100644 --- a/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two postal mail with same type * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two postal mail with same type * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two postal mail with same type * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two postal mail with same type * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/postal_mail/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php index 3d3abedc1..a57e599b2 100644 --- a/codegen/Crm/Objects/PostalMail/Api/SearchApi.php +++ b/codegen/Crm/Objects/PostalMail/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\PostalMail\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\PostalMail\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\PostalMail\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\PostalMail\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\PostalMail\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/postal_mail/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/PostalMail/ApiException.php b/codegen/Crm/Objects/PostalMail/ApiException.php index deb03edbd..39cc65454 100644 --- a/codegen/Crm/Objects/PostalMail/ApiException.php +++ b/codegen/Crm/Objects/PostalMail/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/PostalMail/Configuration.php b/codegen/Crm/Objects/PostalMail/Configuration.php index f74888a8e..ee35fca7f 100644 --- a/codegen/Crm/Objects/PostalMail/Configuration.php +++ b/codegen/Crm/Objects/PostalMail/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/PostalMail/HeaderSelector.php b/codegen/Crm/Objects/PostalMail/HeaderSelector.php index bf4cac3cd..09e22b153 100644 --- a/codegen/Crm/Objects/PostalMail/HeaderSelector.php +++ b/codegen/Crm/Objects/PostalMail/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php index 1afb21f65..6331f83eb 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php index 064bcf866..fe6893a61 100644 --- a/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/PostalMail/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php index 316afe8b8..08530c502 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php index c417a7f19..b07349a7e 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php index 653216b0d..a283c04d1 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php index c1e436e7a..afdc599ae 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php index e51b90db8..d77270ce1 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php index 9533e0001..5b2cb0a3a 100644 --- a/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/PostalMail/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php index eddaabbda..b5a8ceeac 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index c7bf6c97d..c209d22a6 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 4ca0c6b46..25f4c38b6 100644 --- a/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/Error.php b/codegen/Crm/Objects/PostalMail/Model/Error.php index e5b764e80..2c84a8a89 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Error.php +++ b/codegen/Crm/Objects/PostalMail/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php index 38f5d636e..3b6e47190 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/PostalMail/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/Filter.php b/codegen/Crm/Objects/PostalMail/Model/Filter.php index 91dd6682f..f183253a6 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Filter.php +++ b/codegen/Crm/Objects/PostalMail/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php index 4d745fd5a..3548cbd2e 100644 --- a/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php +++ b/codegen/Crm/Objects/PostalMail/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php index 665119abb..f08b7cfe3 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/PostalMail/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php index 56670e12d..6cbab3585 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php +++ b/codegen/Crm/Objects/PostalMail/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/PostalMail/Model/NextPage.php b/codegen/Crm/Objects/PostalMail/Model/NextPage.php index 23fd96865..56c71baef 100644 --- a/codegen/Crm/Objects/PostalMail/Model/NextPage.php +++ b/codegen/Crm/Objects/PostalMail/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/Paging.php b/codegen/Crm/Objects/PostalMail/Model/Paging.php index 82b85b03c..4fc35f716 100644 --- a/codegen/Crm/Objects/PostalMail/Model/Paging.php +++ b/codegen/Crm/Objects/PostalMail/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php index 21a10fe14..6a339e753 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php +++ b/codegen/Crm/Objects/PostalMail/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php index 8e8d1dd27..c511c404b 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/PostalMail/Model/PublicGdprDeleteInput.php index e725a0140..e41dc639f 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php b/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php index 57e5b5dd8..e76c588da 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php index 0b3cdad3f..0dd660f9e 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php index 37fb45cfc..063f40498 100644 --- a/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/PostalMail/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php index db23bd92c..97c9a59e4 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php index f848819a2..17c7dfe2f 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php index f22165867..158354a8a 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php index 0ec4947e6..69e948f5e 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php index 2befada82..ce6b451d2 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php index c1ebcb628..c909c38f3 100644 --- a/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/PostalMail/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/StandardError.php b/codegen/Crm/Objects/PostalMail/Model/StandardError.php index 31efd1098..8c5d25792 100644 --- a/codegen/Crm/Objects/PostalMail/Model/StandardError.php +++ b/codegen/Crm/Objects/PostalMail/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php index 7ebbc2cda..79241f4ec 100644 --- a/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/PostalMail/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/PostalMail/ObjectSerializer.php b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php index f0600d494..12c730c44 100644 --- a/codegen/Crm/Objects/PostalMail/ObjectSerializer.php +++ b/codegen/Crm/Objects/PostalMail/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } diff --git a/codegen/Crm/Objects/Tasks/Api/BasicApi.php b/codegen/Crm/Objects/Tasks/Api/BasicApi.php index 725fdaeba..b67cfa0d4 100644 --- a/codegen/Crm/Objects/Tasks/Api/BasicApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $task_id task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($task_id) + public function archive($task_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($task_id); + $this->archiveWithHttpInfo($task_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($task_id) * Archive * * @param string $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($task_id) + public function archiveWithHttpInfo($task_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($task_id); + $request = $this->archiveRequest($task_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($task_id) * Archive * * @param string $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($task_id) + public function archiveAsync($task_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($task_id) + return $this->archiveAsyncWithHttpInfo($task_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($task_id) + public function archiveAsyncWithHttpInfo($task_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($task_id); + $request = $this->archiveRequest($task_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $task_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($task_id) + public function archiveRequest($task_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'task_id' is set if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($task_id) ); } + $resourcePath = '/crm/v3/objects/tasks/{taskId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($task_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($task_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($task_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($task_id) * Create * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/tasks'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function getById($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($task_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($task_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($task_id, $properties = null, $properties_with_history = * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($task_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($task_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($task_id, $properties = null, $properties_wi * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($task_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($task_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($task_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($task_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($task_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'task_id' is set if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi ); } + + + + + + $resourcePath = '/crm/v3/objects/tasks/{taskId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($task_id, $properties = null, $properties_with_hi * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/tasks'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $task_id task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function update($task_id, $simple_public_object_input, $id_property = null) + public function update($task_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($task_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($task_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($task_id, $simple_public_object_input, $id_property = nul * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($task_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($task_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($task_id, $simple_public_object_input, $id_pr * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($task_id, $simple_public_object_input, $id_property = null) + public function updateAsync($task_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($task_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($task_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($task_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($task_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject'; - $request = $this->updateRequest($task_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($task_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $task_id (required) * @param \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($task_id, $simple_public_object_input, $id_property = null) + public function updateRequest($task_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'task_id' is set if ($task_id === null || (is_array($task_id) && count($task_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $task_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert ); } + + $resourcePath = '/crm/v3/objects/tasks/{taskId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($task_id, $simple_public_object_input, $id_propert $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Tasks/Api/BatchApi.php b/codegen/Crm/Objects/Tasks/Api/BatchApi.php index 99cfe1b0c..d95f05a0e 100644 --- a/codegen/Crm/Objects/Tasks/Api/BatchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of tasks by ID * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of tasks by ID * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of tasks by ID * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of tasks by ID * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/tasks/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/tasks/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/tasks/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of tasks * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/tasks/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Tasks/Api/GDPRApi.php b/codegen/Crm/Objects/Tasks/Api/GDPRApi.php index 40140f900..d53c509c2 100644 --- a/codegen/Crm/Objects/Tasks/Api/GDPRApi.php +++ b/codegen/Crm/Objects/Tasks/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/tasks/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Tasks/Api/PublicObjectApi.php b/codegen/Crm/Objects/Tasks/Api/PublicObjectApi.php index b74b087d4..6d183ed2a 100644 --- a/codegen/Crm/Objects/Tasks/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/Tasks/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two tasks with same type * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two tasks with same type * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two tasks with same type * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two tasks with same type * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/tasks/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Tasks/Api/SearchApi.php b/codegen/Crm/Objects/Tasks/Api/SearchApi.php index f25bb6cc8..62187ee40 100644 --- a/codegen/Crm/Objects/Tasks/Api/SearchApi.php +++ b/codegen/Crm/Objects/Tasks/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Tasks\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Tasks\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Tasks\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Tasks\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\Tasks\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/tasks/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Tasks/ApiException.php b/codegen/Crm/Objects/Tasks/ApiException.php index ff56eeaf7..3d3542cf2 100644 --- a/codegen/Crm/Objects/Tasks/ApiException.php +++ b/codegen/Crm/Objects/Tasks/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/Tasks/Configuration.php b/codegen/Crm/Objects/Tasks/Configuration.php index dfba79d05..912c1ef70 100644 --- a/codegen/Crm/Objects/Tasks/Configuration.php +++ b/codegen/Crm/Objects/Tasks/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/Tasks/HeaderSelector.php b/codegen/Crm/Objects/Tasks/HeaderSelector.php index 556c2dcda..bf00a0ab0 100644 --- a/codegen/Crm/Objects/Tasks/HeaderSelector.php +++ b/codegen/Crm/Objects/Tasks/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php index d6ed2b0e6..74626980a 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php index fdef588f5..4621d0115 100644 --- a/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Tasks/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php index 37d71d6da..52e390181 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php index 8a65aa5c7..de6918967 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php index f6c379342..0ddcd0c00 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php index dd35318b8..061d91230 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php index 28704ed41..4e8f7974a 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php index afdd0836b..adbfa5f71 100644 --- a/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Tasks/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php index b892a2af7..34530efaf 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index f6339e681..0b0ec0a69 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 6c89efb06..2e0360cb4 100644 --- a/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/Error.php b/codegen/Crm/Objects/Tasks/Model/Error.php index 18797742c..335fb48b3 100644 --- a/codegen/Crm/Objects/Tasks/Model/Error.php +++ b/codegen/Crm/Objects/Tasks/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php b/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php index c50815b34..912976a60 100644 --- a/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Tasks/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/Filter.php b/codegen/Crm/Objects/Tasks/Model/Filter.php index 93e3b7f92..d7fda332a 100644 --- a/codegen/Crm/Objects/Tasks/Model/Filter.php +++ b/codegen/Crm/Objects/Tasks/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Tasks/Model/FilterGroup.php b/codegen/Crm/Objects/Tasks/Model/FilterGroup.php index 1f5fa313b..1a4cafa78 100644 --- a/codegen/Crm/Objects/Tasks/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Tasks/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php b/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php index 8fbd89961..e6837b1eb 100644 --- a/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Tasks/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/ModelInterface.php b/codegen/Crm/Objects/Tasks/Model/ModelInterface.php index 9c95dbc98..b2c66ea6f 100644 --- a/codegen/Crm/Objects/Tasks/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Tasks/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/Tasks/Model/NextPage.php b/codegen/Crm/Objects/Tasks/Model/NextPage.php index 2f0c11747..491bc3b62 100644 --- a/codegen/Crm/Objects/Tasks/Model/NextPage.php +++ b/codegen/Crm/Objects/Tasks/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/Paging.php b/codegen/Crm/Objects/Tasks/Model/Paging.php index 6877c3a81..a24a69f0a 100644 --- a/codegen/Crm/Objects/Tasks/Model/Paging.php +++ b/codegen/Crm/Objects/Tasks/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PreviousPage.php b/codegen/Crm/Objects/Tasks/Model/PreviousPage.php index 925ce5532..b108baab2 100644 --- a/codegen/Crm/Objects/Tasks/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Tasks/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php index 19d8af9d0..594957665 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/Tasks/Model/PublicGdprDeleteInput.php index fe9ee93a2..b34fcac60 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PublicMergeInput.php b/codegen/Crm/Objects/Tasks/Model/PublicMergeInput.php index 5020497ba..3e4222fd9 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php index 3b42c02e0..23745af81 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php index ebcf55ad8..1cd9bf039 100644 --- a/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Tasks/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php index 6690bf472..798247447 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php index 1767098fc..1ff14bb88 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php index 432afc084..16fcf0efa 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php index afc7e12ae..7b77083d5 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php index e175bb977..108d15b38 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php index 743541d2d..473acc6a4 100644 --- a/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Tasks/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/StandardError.php b/codegen/Crm/Objects/Tasks/Model/StandardError.php index 85e070922..4d5400f6b 100644 --- a/codegen/Crm/Objects/Tasks/Model/StandardError.php +++ b/codegen/Crm/Objects/Tasks/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php index 542f191cf..8c78da7ff 100644 --- a/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Tasks/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/Tasks/ObjectSerializer.php b/codegen/Crm/Objects/Tasks/ObjectSerializer.php index d08327671..a0abc13f5 100644 --- a/codegen/Crm/Objects/Tasks/ObjectSerializer.php +++ b/codegen/Crm/Objects/Tasks/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } diff --git a/codegen/Crm/Objects/Taxes/Api/BasicApi.php b/codegen/Crm/Objects/Taxes/Api/BasicApi.php index 0b0e45856..80f2749c2 100644 --- a/codegen/Crm/Objects/Taxes/Api/BasicApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,25 @@ class BasicApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'getById' => [ + 'application/json', + ], + 'getPage' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +140,15 @@ public function getConfig() * Archive * * @param string $tax_id tax_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($tax_id) + public function archive($tax_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($tax_id); + $this->archiveWithHttpInfo($tax_id, $contentType); } /** @@ -137,14 +157,15 @@ public function archive($tax_id) * Archive * * @param string $tax_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($tax_id) + public function archiveWithHttpInfo($tax_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($tax_id); + $request = $this->archiveRequest($tax_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +225,14 @@ public function archiveWithHttpInfo($tax_id) * Archive * * @param string $tax_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($tax_id) + public function archiveAsync($tax_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($tax_id) + return $this->archiveAsyncWithHttpInfo($tax_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +246,15 @@ function ($response) { * Archive * * @param string $tax_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($tax_id) + public function archiveAsyncWithHttpInfo($tax_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($tax_id); + $request = $this->archiveRequest($tax_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +283,14 @@ function ($exception) { * Create request for operation 'archive' * * @param string $tax_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($tax_id) + public function archiveRequest($tax_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'tax_id' is set if ($tax_id === null || (is_array($tax_id) && count($tax_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +298,7 @@ public function archiveRequest($tax_id) ); } + $resourcePath = '/crm/v3/objects/taxes/{taxId}'; $formParams = []; $queryParams = []; @@ -292,16 +318,11 @@ public function archiveRequest($tax_id) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -319,9 +340,9 @@ public function archiveRequest($tax_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -344,10 +365,11 @@ public function archiveRequest($tax_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -359,14 +381,15 @@ public function archiveRequest($tax_id) * Create * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function create($simple_public_object_input_for_create) + public function create($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($simple_public_object_input_for_create, $contentType); return $response; } @@ -376,14 +399,15 @@ public function create($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($simple_public_object_input_for_create) + public function createWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -427,7 +451,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -442,7 +478,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -459,7 +507,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -498,13 +558,14 @@ public function createWithHttpInfo($simple_public_object_input_for_create) * Create * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($simple_public_object_input_for_create) + public function createAsync($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -518,14 +579,15 @@ function ($response) { * Create * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject'; - $request = $this->createRequest($simple_public_object_input_for_create); + $request = $this->createRequest($simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -567,12 +629,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($simple_public_object_input_for_create) + public function createRequest($simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'simple_public_object_input_for_create' is set if ($simple_public_object_input_for_create === null || (is_array($simple_public_object_input_for_create) && count($simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -580,6 +644,7 @@ public function createRequest($simple_public_object_input_for_create) ); } + $resourcePath = '/crm/v3/objects/taxes'; $formParams = []; $queryParams = []; @@ -591,21 +656,17 @@ public function createRequest($simple_public_object_input_for_create) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input_for_create)); } else { $httpBody = $simple_public_object_input_for_create; } @@ -624,9 +685,9 @@ public function createRequest($simple_public_object_input_for_create) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -649,10 +710,11 @@ public function createRequest($simple_public_object_input_for_create) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -669,14 +731,15 @@ public function createRequest($simple_public_object_input_for_create) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function getById($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getById($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - list($response) = $this->getByIdWithHttpInfo($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property); + list($response) = $this->getByIdWithHttpInfo($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $response; } @@ -691,14 +754,15 @@ public function getById($tax_id, $properties = null, $properties_with_history = * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - $request = $this->getByIdRequest($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -742,7 +806,19 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -757,7 +833,19 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -774,7 +862,19 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -818,13 +918,14 @@ public function getByIdWithHttpInfo($tax_id, $properties = null, $properties_wit * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsync($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsync($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { - return $this->getByIdAsyncWithHttpInfo($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property) + return $this->getByIdAsyncWithHttpInfo($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -843,14 +944,15 @@ function ($response) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByIdAsyncWithHttpInfo($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdAsyncWithHttpInfo($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectWithAssociations'; - $request = $this->getByIdRequest($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property); + $request = $this->getByIdRequest($tax_id, $properties, $properties_with_history, $associations, $archived, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -897,12 +999,14 @@ function ($exception) { * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByIdRequest($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null) + public function getByIdRequest($tax_id, $properties = null, $properties_with_history = null, $associations = null, $archived = false, $id_property = null, string $contentType = self::contentTypes['getById'][0]) { + // verify the required parameter 'tax_id' is set if ($tax_id === null || (is_array($tax_id) && count($tax_id) === 0)) { throw new \InvalidArgumentException( @@ -910,6 +1014,12 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his ); } + + + + + + $resourcePath = '/crm/v3/objects/taxes/{taxId}'; $formParams = []; $queryParams = []; @@ -974,16 +1084,11 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1001,9 +1106,9 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1026,10 +1131,11 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1046,14 +1152,15 @@ public function getByIdRequest($tax_id, $properties = null, $properties_with_his * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPage($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived); + list($response) = $this->getPageWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $response; } @@ -1068,14 +1175,15 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -1119,7 +1227,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1134,7 +1254,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1151,7 +1283,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1195,13 +1339,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsync($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived) + return $this->getPageAsyncWithHttpInfo($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -1220,14 +1365,15 @@ function ($response) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageAsyncWithHttpInfo($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; - $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived); + $request = $this->getPageRequest($limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1274,13 +1420,21 @@ function ($exception) { * @param string[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false) + public function getPageRequest($limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { + + + + + + + $resourcePath = '/crm/v3/objects/taxes'; $formParams = []; $queryParams = []; @@ -1346,16 +1500,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1373,9 +1522,9 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1398,10 +1547,11 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1415,14 +1565,15 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * @param string $tax_id tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function update($tax_id, $simple_public_object_input, $id_property = null) + public function update($tax_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($tax_id, $simple_public_object_input, $id_property); + list($response) = $this->updateWithHttpInfo($tax_id, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1434,14 +1585,15 @@ public function update($tax_id, $simple_public_object_input, $id_property = null * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_property = null) + public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($tax_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($tax_id, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1485,7 +1637,19 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1500,7 +1664,19 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1517,7 +1693,19 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1558,13 +1746,14 @@ public function updateWithHttpInfo($tax_id, $simple_public_object_input, $id_pro * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($tax_id, $simple_public_object_input, $id_property = null) + public function updateAsync($tax_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($tax_id, $simple_public_object_input, $id_property) + return $this->updateAsyncWithHttpInfo($tax_id, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1580,14 +1769,15 @@ function ($response) { * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($tax_id, $simple_public_object_input, $id_property = null) + public function updateAsyncWithHttpInfo($tax_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject'; - $request = $this->updateRequest($tax_id, $simple_public_object_input, $id_property); + $request = $this->updateRequest($tax_id, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1631,18 +1821,21 @@ function ($exception) { * @param string $tax_id (required) * @param \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObjectInput $simple_public_object_input (required) * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($tax_id, $simple_public_object_input, $id_property = null) + public function updateRequest($tax_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'tax_id' is set if ($tax_id === null || (is_array($tax_id) && count($tax_id) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $tax_id when calling update' ); } + // verify the required parameter 'simple_public_object_input' is set if ($simple_public_object_input === null || (is_array($simple_public_object_input) && count($simple_public_object_input) === 0)) { throw new \InvalidArgumentException( @@ -1650,6 +1843,8 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property ); } + + $resourcePath = '/crm/v3/objects/taxes/{taxId}'; $formParams = []; $queryParams = []; @@ -1678,21 +1873,17 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($simple_public_object_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($simple_public_object_input)); } else { $httpBody = $simple_public_object_input; } @@ -1711,9 +1902,9 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1736,10 +1927,11 @@ public function updateRequest($tax_id, $simple_public_object_input, $id_property $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Taxes/Api/BatchApi.php b/codegen/Crm/Objects/Taxes/Api/BatchApi.php index ac7cf4e20..814e5cf22 100644 --- a/codegen/Crm/Objects/Taxes/Api/BatchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,22 @@ class BatchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'archive' => [ + 'application/json', + ], + 'create' => [ + 'application/json', + ], + 'read' => [ + 'application/json', + ], + 'update' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +137,15 @@ public function getConfig() * Archive a batch of taxes by ID * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function archive($batch_input_simple_public_object_id) + public function archive($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $this->archiveWithHttpInfo($batch_input_simple_public_object_id); + $this->archiveWithHttpInfo($batch_input_simple_public_object_id, $contentType); } /** @@ -137,14 +154,15 @@ public function archive($batch_input_simple_public_object_id) * Archive a batch of taxes by ID * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function archiveWithHttpInfo($batch_input_simple_public_object_id) + public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +222,14 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id) * Archive a batch of taxes by ID * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsync($batch_input_simple_public_object_id) + public function archiveAsync($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { - return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + return $this->archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +243,15 @@ function ($response) { * Archive a batch of taxes by ID * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id) + public function archiveAsyncWithHttpInfo($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { $returnType = ''; - $request = $this->archiveRequest($batch_input_simple_public_object_id); + $request = $this->archiveRequest($batch_input_simple_public_object_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +280,14 @@ function ($exception) { * Create request for operation 'archive' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function archiveRequest($batch_input_simple_public_object_id) + public function archiveRequest($batch_input_simple_public_object_id, string $contentType = self::contentTypes['archive'][0]) { + // verify the required parameter 'batch_input_simple_public_object_id' is set if ($batch_input_simple_public_object_id === null || (is_array($batch_input_simple_public_object_id) && count($batch_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +295,7 @@ public function archiveRequest($batch_input_simple_public_object_id) ); } + $resourcePath = '/crm/v3/objects/taxes/batch/archive'; $formParams = []; $queryParams = []; @@ -284,21 +307,17 @@ public function archiveRequest($batch_input_simple_public_object_id) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_id)); } else { $httpBody = $batch_input_simple_public_object_id; } @@ -317,9 +336,9 @@ public function archiveRequest($batch_input_simple_public_object_id) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +361,11 @@ public function archiveRequest($batch_input_simple_public_object_id) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -357,14 +377,15 @@ public function archiveRequest($batch_input_simple_public_object_id) * Create a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create) + public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); return $response; } @@ -374,14 +395,15 @@ public function create($batch_input_simple_public_object_input_for_create) * Create a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -425,7 +447,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -440,7 +474,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -455,7 +501,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -472,7 +530,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -519,13 +589,14 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * Create a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create) + public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -539,14 +610,15 @@ function ($response) { * Create a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create); + $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -588,12 +660,14 @@ function ($exception) { * Create request for operation 'create' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create) + public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) { + // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { throw new \InvalidArgumentException( @@ -601,6 +675,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); } + $resourcePath = '/crm/v3/objects/taxes/batch/create'; $formParams = []; $queryParams = []; @@ -612,21 +687,17 @@ public function createRequest($batch_input_simple_public_object_input_for_create - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_input_for_create)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); } else { $httpBody = $batch_input_simple_public_object_input_for_create; } @@ -645,9 +716,9 @@ public function createRequest($batch_input_simple_public_object_input_for_create // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -670,10 +741,11 @@ public function createRequest($batch_input_simple_public_object_input_for_create $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -686,14 +758,15 @@ public function createRequest($batch_input_simple_public_object_input_for_create * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function read($batch_read_input_simple_public_object_id, $archived = false) + public function read($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived); + list($response) = $this->readWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType); return $response; } @@ -704,14 +777,15 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); try { $options = $this->createHttpClientOption(); @@ -755,7 +829,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -770,7 +856,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -785,7 +883,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -802,7 +912,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -850,13 +972,14 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsync($batch_read_input_simple_public_object_id, $archived = false) + public function readAsync($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived) + return $this->readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived, $contentType) ->then( function ($response) { return $response[0]; @@ -871,14 +994,15 @@ function ($response) { * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false) + public function readAsyncWithHttpInfo($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; - $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived); + $request = $this->readRequest($batch_read_input_simple_public_object_id, $archived, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -921,12 +1045,14 @@ function ($exception) { * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['read'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function readRequest($batch_read_input_simple_public_object_id, $archived = false) + public function readRequest($batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { + // verify the required parameter 'batch_read_input_simple_public_object_id' is set if ($batch_read_input_simple_public_object_id === null || (is_array($batch_read_input_simple_public_object_id) && count($batch_read_input_simple_public_object_id) === 0)) { throw new \InvalidArgumentException( @@ -934,6 +1060,8 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived ); } + + $resourcePath = '/crm/v3/objects/taxes/batch/read'; $formParams = []; $queryParams = []; @@ -954,21 +1082,17 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_read_input_simple_public_object_id)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_read_input_simple_public_object_id)); } else { $httpBody = $batch_read_input_simple_public_object_id; } @@ -987,9 +1111,9 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1012,10 +1136,11 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1027,14 +1152,15 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived * Update a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function update($batch_input_simple_public_object_batch_input) + public function update($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input); + list($response) = $this->updateWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType); return $response; } @@ -1044,14 +1170,15 @@ public function update($batch_input_simple_public_object_batch_input) * Update a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1095,7 +1222,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1110,7 +1249,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObjectWithErrors' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1125,7 +1276,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1142,7 +1305,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -1189,13 +1364,14 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input * Update a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($batch_input_simple_public_object_batch_input) + public function updateAsync($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + return $this->updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, $contentType) ->then( function ($response) { return $response[0]; @@ -1209,14 +1385,15 @@ function ($response) { * Update a batch of taxes * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input) + public function updateAsyncWithHttpInfo($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\BatchResponseSimplePublicObject'; - $request = $this->updateRequest($batch_input_simple_public_object_batch_input); + $request = $this->updateRequest($batch_input_simple_public_object_batch_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1258,12 +1435,14 @@ function ($exception) { * Create request for operation 'update' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($batch_input_simple_public_object_batch_input) + public function updateRequest($batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { + // verify the required parameter 'batch_input_simple_public_object_batch_input' is set if ($batch_input_simple_public_object_batch_input === null || (is_array($batch_input_simple_public_object_batch_input) && count($batch_input_simple_public_object_batch_input) === 0)) { throw new \InvalidArgumentException( @@ -1271,6 +1450,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input) ); } + $resourcePath = '/crm/v3/objects/taxes/batch/update'; $formParams = []; $queryParams = []; @@ -1282,21 +1462,17 @@ public function updateRequest($batch_input_simple_public_object_batch_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($batch_input_simple_public_object_batch_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input)); } else { $httpBody = $batch_input_simple_public_object_batch_input; } @@ -1315,9 +1491,9 @@ public function updateRequest($batch_input_simple_public_object_batch_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -1340,10 +1516,11 @@ public function updateRequest($batch_input_simple_public_object_batch_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Taxes/Api/GDPRApi.php b/codegen/Crm/Objects/Taxes/Api/GDPRApi.php index 207a9582f..bddd32e45 100644 --- a/codegen/Crm/Objects/Taxes/Api/GDPRApi.php +++ b/codegen/Crm/Objects/Taxes/Api/GDPRApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class GDPRApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'purge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function purge($public_gdpr_delete_input) + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $this->purgeWithHttpInfo($public_gdpr_delete_input); + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); } /** @@ -137,14 +145,15 @@ public function purge($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function purgeWithHttpInfo($public_gdpr_delete_input) + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -204,13 +213,14 @@ public function purgeWithHttpInfo($public_gdpr_delete_input) * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsync($public_gdpr_delete_input) + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input) + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) ->then( function ($response) { return $response[0]; @@ -224,14 +234,15 @@ function ($response) { * GDPR DELETE * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input) + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input); + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -260,12 +271,14 @@ function ($exception) { * Create request for operation 'purge' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function purgeRequest($public_gdpr_delete_input) + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) { + // verify the required parameter 'public_gdpr_delete_input' is set if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { throw new \InvalidArgumentException( @@ -273,6 +286,7 @@ public function purgeRequest($public_gdpr_delete_input) ); } + $resourcePath = '/crm/v3/objects/taxes/gdpr-delete'; $formParams = []; $queryParams = []; @@ -284,21 +298,17 @@ public function purgeRequest($public_gdpr_delete_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_gdpr_delete_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); } else { $httpBody = $public_gdpr_delete_input; } @@ -317,9 +327,9 @@ public function purgeRequest($public_gdpr_delete_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -342,10 +352,11 @@ public function purgeRequest($public_gdpr_delete_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Taxes/Api/PublicObjectApi.php b/codegen/Crm/Objects/Taxes/Api/PublicObjectApi.php index e171c7d0b..cd243f8d5 100644 --- a/codegen/Crm/Objects/Taxes/Api/PublicObjectApi.php +++ b/codegen/Crm/Objects/Taxes/Api/PublicObjectApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class PublicObjectApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'merge' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -121,14 +128,15 @@ public function getConfig() * Merge two taxes with same type * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function merge($public_merge_input) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->mergeWithHttpInfo($public_merge_input); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } @@ -138,14 +146,15 @@ public function merge($public_merge_input) * Merge two taxes with same type * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function mergeWithHttpInfo($public_merge_input) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,7 +198,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -204,7 +225,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -221,7 +254,19 @@ public function mergeWithHttpInfo($public_merge_input) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -260,13 +305,14 @@ public function mergeWithHttpInfo($public_merge_input) * Merge two taxes with same type * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsync($public_merge_input) + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - return $this->mergeAsyncWithHttpInfo($public_merge_input) + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) ->then( function ($response) { return $response[0]; @@ -280,14 +326,15 @@ function ($response) { * Merge two taxes with same type * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function mergeAsyncWithHttpInfo($public_merge_input) + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input); + $request = $this->mergeRequest($public_merge_input, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,12 +376,14 @@ function ($exception) { * Create request for operation 'merge' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function mergeRequest($public_merge_input) + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { + // verify the required parameter 'public_merge_input' is set if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { throw new \InvalidArgumentException( @@ -342,6 +391,7 @@ public function mergeRequest($public_merge_input) ); } + $resourcePath = '/crm/v3/objects/taxes/merge'; $formParams = []; $queryParams = []; @@ -353,21 +403,17 @@ public function mergeRequest($public_merge_input) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_merge_input)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); } else { $httpBody = $public_merge_input; } @@ -386,9 +432,9 @@ public function mergeRequest($public_merge_input) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -411,10 +457,11 @@ public function mergeRequest($public_merge_input) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Taxes/Api/SearchApi.php b/codegen/Crm/Objects/Taxes/Api/SearchApi.php index e9286cfc7..a05567719 100644 --- a/codegen/Crm/Objects/Taxes/Api/SearchApi.php +++ b/codegen/Crm/Objects/Taxes/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -69,6 +69,13 @@ class SearchApi */ protected $hostIndex; + /** @var string[] $contentTypes **/ + public const contentTypes = [ + 'doSearch' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -119,14 +126,15 @@ public function getConfig() * Operation doSearch * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Taxes\Model\Error */ - public function doSearch($public_object_search_request) + public function doSearch($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - list($response) = $this->doSearchWithHttpInfo($public_object_search_request); + list($response) = $this->doSearchWithHttpInfo($public_object_search_request, $contentType); return $response; } @@ -134,14 +142,15 @@ public function doSearch($public_object_search_request) * Operation doSearchWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * - * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response + * @throws \HubSpot\Client\Crm\Objects\Taxes\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging|\HubSpot\Client\Crm\Objects\Taxes\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function doSearchWithHttpInfo($public_object_search_request) + public function doSearchWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -185,7 +194,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -200,7 +221,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ('\HubSpot\Client\Crm\Objects\Taxes\Model\Error' !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -217,7 +250,19 @@ public function doSearchWithHttpInfo($public_object_search_request) } else { $content = (string) $response->getBody(); if ($returnType !== 'string') { - $content = json_decode($content); + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } } } @@ -254,13 +299,14 @@ public function doSearchWithHttpInfo($public_object_search_request) * Operation doSearchAsync * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsync($public_object_search_request) + public function doSearchAsync($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { - return $this->doSearchAsyncWithHttpInfo($public_object_search_request) + return $this->doSearchAsyncWithHttpInfo($public_object_search_request, $contentType) ->then( function ($response) { return $response[0]; @@ -272,14 +318,15 @@ function ($response) { * Operation doSearchAsyncWithHttpInfo * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function doSearchAsyncWithHttpInfo($public_object_search_request) + public function doSearchAsyncWithHttpInfo($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Taxes\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; - $request = $this->doSearchRequest($public_object_search_request); + $request = $this->doSearchRequest($public_object_search_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -321,12 +368,14 @@ function ($exception) { * Create request for operation 'doSearch' * * @param \HubSpot\Client\Crm\Objects\Taxes\Model\PublicObjectSearchRequest $public_object_search_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function doSearchRequest($public_object_search_request) + public function doSearchRequest($public_object_search_request, string $contentType = self::contentTypes['doSearch'][0]) { + // verify the required parameter 'public_object_search_request' is set if ($public_object_search_request === null || (is_array($public_object_search_request) && count($public_object_search_request) === 0)) { throw new \InvalidArgumentException( @@ -334,6 +383,7 @@ public function doSearchRequest($public_object_search_request) ); } + $resourcePath = '/crm/v3/objects/taxes/search'; $formParams = []; $queryParams = []; @@ -345,21 +395,17 @@ public function doSearchRequest($public_object_search_request) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json', '*/*'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($public_object_search_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_object_search_request)); } else { $httpBody = $public_object_search_request; } @@ -378,9 +424,9 @@ public function doSearchRequest($public_object_search_request) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) $httpBody = ObjectSerializer::buildQuery($formParams); @@ -403,10 +449,11 @@ public function doSearchRequest($public_object_search_request) $headers ); + $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/codegen/Crm/Objects/Taxes/ApiException.php b/codegen/Crm/Objects/Taxes/ApiException.php index 598053ed1..76838fed3 100644 --- a/codegen/Crm/Objects/Taxes/ApiException.php +++ b/codegen/Crm/Objects/Taxes/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** diff --git a/codegen/Crm/Objects/Taxes/Configuration.php b/codegen/Crm/Objects/Taxes/Configuration.php index 8876e47a1..719532eb0 100644 --- a/codegen/Crm/Objects/Taxes/Configuration.php +++ b/codegen/Crm/Objects/Taxes/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -209,7 +209,7 @@ public function getAccessToken() /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ @@ -479,32 +479,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -517,4 +516,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/codegen/Crm/Objects/Taxes/HeaderSelector.php b/codegen/Crm/Objects/Taxes/HeaderSelector.php index a51e5530c..2903e2e92 100644 --- a/codegen/Crm/Objects/Taxes/HeaderSelector.php +++ b/codegen/Crm/Objects/Taxes/HeaderSelector.php @@ -1,6 +1,6 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); } /** - * Return the content type based on an array of content-type provided + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php index bf6753f86..d62ee5876 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociatedId.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociatedId implements ModelInterface, ArrayAccess, \JsonSerializable 'type' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -258,6 +348,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php index 672b45db7..51d0dae1e 100644 --- a/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php +++ b/codegen/Crm/Objects/Taxes/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class AssociationSpec implements ModelInterface, ArrayAccess, \JsonSerializable 'association_type_id' => 'int32' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'association_category' => false, + 'association_type_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -198,8 +267,26 @@ public function getAssociationCategoryAllowableValues() */ public function __construct(array $data = null) { - $this->container['association_category'] = $data['association_category'] ?? null; - $this->container['association_type_id'] = $data['association_type_id'] ?? null; + $this->setIfExists('association_category', $data ?? [], null); + $this->setIfExists('association_type_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,6 +347,9 @@ public function getAssociationCategory() */ public function setAssociationCategory($association_category) { + if (is_null($association_category)) { + throw new \InvalidArgumentException('non-nullable association_category cannot be null'); + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!in_array($association_category, $allowedValues, true)) { throw new \InvalidArgumentException( @@ -294,6 +384,9 @@ public function getAssociationTypeId() */ public function setAssociationTypeId($association_type_id) { + if (is_null($association_type_id)) { + throw new \InvalidArgumentException('non-nullable association_type_id cannot be null'); + } $this->container['association_type_id'] = $association_type_id; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php index dc4c555ab..d0caeaa2c 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectBatchInput implements ModelInterface, ArrayAcc 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php index 9de7f621f..2badeaf19 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectId implements ModelInterface, ArrayAccess, \Js 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php index 8a417869e..2654474c4 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchInputSimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra 'inputs' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'inputs' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['inputs'] = $data['inputs'] ?? null; + $this->setIfExists('inputs', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php index 3fe82a724..e73ece96b 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -77,6 +77,25 @@ class BatchReadInputSimplePublicObjectId implements ModelInterface, ArrayAccess, 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties_with_history' => false, + 'id_property' => false, + 'inputs' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +116,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -191,10 +262,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['inputs'] = $data['inputs'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('inputs', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +338,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -273,6 +365,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -297,6 +392,9 @@ public function getInputs() */ public function setInputs($inputs) { + if (is_null($inputs)) { + throw new \InvalidArgumentException('non-nullable inputs cannot be null'); + } $this->container['inputs'] = $inputs; return $this; @@ -321,6 +419,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php index 9c5f04012..89e538620 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,12 +293,30 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,6 +383,9 @@ public function getCompletedAt() */ 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; @@ -316,6 +410,9 @@ public function getRequestedAt() */ 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; @@ -340,6 +437,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -364,6 +464,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -388,6 +491,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -412,6 +518,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php index c65ea30b5..c554f136a 100644 --- a/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Objects/Taxes/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, Array 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'num_errors' => false, + 'requested_at' => false, + 'started_at' => false, + 'links' => false, + 'results' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,14 +305,32 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['completed_at'] = $data['completed_at'] ?? null; - $this->container['num_errors'] = $data['num_errors'] ?? null; - $this->container['requested_at'] = $data['requested_at'] ?? null; - $this->container['started_at'] = $data['started_at'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['results'] = $data['results'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +397,9 @@ public function getCompletedAt() */ 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; @@ -328,6 +424,9 @@ public function getNumErrors() */ public function setNumErrors($num_errors) { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } $this->container['num_errors'] = $num_errors; return $this; @@ -352,6 +451,9 @@ public function getRequestedAt() */ 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; @@ -376,6 +478,9 @@ public function getStartedAt() */ public function setStartedAt($started_at) { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } $this->container['started_at'] = $started_at; return $this; @@ -400,6 +505,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -424,6 +532,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; @@ -448,6 +559,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -472,6 +586,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php index 1057211c4..fd9141926 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseAssociatedId implements ModelInterface, ArrayAccess, \Js 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index bbf9bbdca..1638c0c88 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implemen 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -255,6 +345,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 0e947076c..2e2a10d90 100644 --- a/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class CollectionResponseWithTotalSimplePublicObjectForwardPaging implements Mode 'results' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'total' => false, + 'paging' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['total'] = $data['total'] ?? null; - $this->container['paging'] = $data['paging'] ?? null; - $this->container['results'] = $data['results'] ?? null; + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('paging', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getTotal() */ public function setTotal($total) { + if (is_null($total)) { + throw new \InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -264,6 +355,9 @@ public function getPaging() */ public function setPaging($paging) { + if (is_null($paging)) { + throw new \InvalidArgumentException('non-nullable paging cannot be null'); + } $this->container['paging'] = $paging; return $this; @@ -288,6 +382,9 @@ public function getResults() */ public function setResults($results) { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } $this->container['results'] = $results; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/Error.php b/codegen/Crm/Objects/Taxes/Model/Error.php index 786432193..3a57f7530 100644 --- a/codegen/Crm/Objects/Taxes/Model/Error.php +++ b/codegen/Crm/Objects/Taxes/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'correlation_id' => false, + 'links' => false, + 'message' => false, + 'category' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['correlation_id'] = $data['correlation_id'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +359,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -291,6 +386,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -315,6 +413,9 @@ public function getCorrelationId() */ public function setCorrelationId($correlation_id) { + if (is_null($correlation_id)) { + throw new \InvalidArgumentException('non-nullable correlation_id cannot be null'); + } $this->container['correlation_id'] = $correlation_id; return $this; @@ -339,6 +440,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -363,6 +467,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -387,6 +494,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -411,6 +521,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php b/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php index b325a643d..a8871f4a4 100644 --- a/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Taxes/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable 'message' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'code' => false, + 'in' => false, + 'context' => false, + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -196,11 +268,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['in'] = $data['in'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['message'] = $data['message'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,6 +339,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -273,6 +366,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -297,6 +393,9 @@ public function getIn() */ public function setIn($in) { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } $this->container['in'] = $in; return $this; @@ -321,6 +420,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -345,6 +447,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/Filter.php b/codegen/Crm/Objects/Taxes/Model/Filter.php index f2a980b92..76b541a0a 100644 --- a/codegen/Crm/Objects/Taxes/Model/Filter.php +++ b/codegen/Crm/Objects/Taxes/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -79,6 +79,26 @@ class Filter implements ModelInterface, ArrayAccess, \JsonSerializable 'operator' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'high_value' => false, + 'property_name' => false, + 'values' => false, + 'value' => false, + 'operator' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +119,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -233,11 +305,29 @@ public function getOperatorAllowableValues() */ public function __construct(array $data = null) { - $this->container['high_value'] = $data['high_value'] ?? null; - $this->container['property_name'] = $data['property_name'] ?? null; - $this->container['values'] = $data['values'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; + $this->setIfExists('high_value', $data ?? [], null); + $this->setIfExists('property_name', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -298,6 +388,9 @@ public function getHighValue() */ public function setHighValue($high_value) { + if (is_null($high_value)) { + throw new \InvalidArgumentException('non-nullable high_value cannot be null'); + } $this->container['high_value'] = $high_value; return $this; @@ -322,6 +415,9 @@ public function getPropertyName() */ public function setPropertyName($property_name) { + if (is_null($property_name)) { + throw new \InvalidArgumentException('non-nullable property_name cannot be null'); + } $this->container['property_name'] = $property_name; return $this; @@ -346,6 +442,9 @@ public function getValues() */ public function setValues($values) { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -370,6 +469,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -394,6 +496,9 @@ public function getOperator() */ public function setOperator($operator) { + if (is_null($operator)) { + throw new \InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new \InvalidArgumentException( diff --git a/codegen/Crm/Objects/Taxes/Model/FilterGroup.php b/codegen/Crm/Objects/Taxes/Model/FilterGroup.php index eabfde6b3..75f0efced 100644 --- a/codegen/Crm/Objects/Taxes/Model/FilterGroup.php +++ b/codegen/Crm/Objects/Taxes/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class FilterGroup implements ModelInterface, ArrayAccess, \JsonSerializable 'filters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'filters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['filters'] = $data['filters'] ?? null; + $this->setIfExists('filters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getFilters() */ public function setFilters($filters) { + if (is_null($filters)) { + throw new \InvalidArgumentException('non-nullable filters cannot be null'); + } $this->container['filters'] = $filters; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php b/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php index 3136de2aa..27b71e89d 100644 --- a/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php +++ b/codegen/Crm/Objects/Taxes/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable 'next' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -222,6 +308,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/ModelInterface.php b/codegen/Crm/Objects/Taxes/Model/ModelInterface.php index ce3fb0ae2..084bdd44e 100644 --- a/codegen/Crm/Objects/Taxes/Model/ModelInterface.php +++ b/codegen/Crm/Objects/Taxes/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -92,4 +92,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/codegen/Crm/Objects/Taxes/Model/NextPage.php b/codegen/Crm/Objects/Taxes/Model/NextPage.php index 3decb20d9..f532612fa 100644 --- a/codegen/Crm/Objects/Taxes/Model/NextPage.php +++ b/codegen/Crm/Objects/Taxes/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable 'after' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'link' => false, + 'after' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['link'] = $data['link'] ?? null; - $this->container['after'] = $data['after'] ?? null; + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; @@ -255,6 +345,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/Paging.php b/codegen/Crm/Objects/Taxes/Model/Paging.php index 0a14c21a9..c4f569288 100644 --- a/codegen/Crm/Objects/Taxes/Model/Paging.php +++ b/codegen/Crm/Objects/Taxes/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class Paging implements ModelInterface, ArrayAccess, \JsonSerializable 'prev' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false, + 'prev' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['next'] = $data['next'] ?? null; - $this->container['prev'] = $data['prev'] ?? null; + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('prev', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -228,6 +315,9 @@ public function getNext() */ public function setNext($next) { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } $this->container['next'] = $next; return $this; @@ -252,6 +342,9 @@ public function getPrev() */ public function setPrev($prev) { + if (is_null($prev)) { + throw new \InvalidArgumentException('non-nullable prev cannot be null'); + } $this->container['prev'] = $prev; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PreviousPage.php b/codegen/Crm/Objects/Taxes/Model/PreviousPage.php index 5b2fcb19f..a26690b76 100644 --- a/codegen/Crm/Objects/Taxes/Model/PreviousPage.php +++ b/codegen/Crm/Objects/Taxes/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PreviousPage implements ModelInterface, ArrayAccess, \JsonSerializable 'link' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'before' => false, + 'link' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['before'] = $data['before'] ?? null; - $this->container['link'] = $data['link'] ?? null; + $this->setIfExists('before', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getBefore() */ public function setBefore($before) { + if (is_null($before)) { + throw new \InvalidArgumentException('non-nullable before cannot be null'); + } $this->container['before'] = $before; return $this; @@ -255,6 +345,9 @@ public function getLink() */ public function setLink($link) { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } $this->container['link'] = $link; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php b/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php index dd94bddc0..510c49912 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicAssociationsForObject implements ModelInterface, ArrayAccess, \JsonS 'to' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'types' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['types'] = $data['types'] ?? null; - $this->container['to'] = $data['to'] ?? null; + $this->setIfExists('types', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getTypes() */ public function setTypes($types) { + if (is_null($types)) { + throw new \InvalidArgumentException('non-nullable types cannot be null'); + } $this->container['types'] = $types; return $this; @@ -258,6 +348,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PublicGdprDeleteInput.php b/codegen/Crm/Objects/Taxes/Model/PublicGdprDeleteInput.php index 995bc84b7..65597f711 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicGdprDeleteInput implements ModelInterface, ArrayAccess, \JsonSeriali 'object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['object_id'] = $data['object_id'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,6 +318,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -255,6 +345,9 @@ public function getObjectId() */ public function setObjectId($object_id) { + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + } $this->container['object_id'] = $object_id; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PublicMergeInput.php b/codegen/Crm/Objects/Taxes/Model/PublicMergeInput.php index a22a282a2..3ae897e50 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicMergeInput.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class PublicMergeInput implements ModelInterface, ArrayAccess, \JsonSerializable 'primary_object_id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'object_id_to_merge' => false, + 'primary_object_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['object_id_to_merge'] = $data['object_id_to_merge'] ?? null; - $this->container['primary_object_id'] = $data['primary_object_id'] ?? null; + $this->setIfExists('object_id_to_merge', $data ?? [], null); + $this->setIfExists('primary_object_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getObjectIdToMerge() */ public function setObjectIdToMerge($object_id_to_merge) { + if (is_null($object_id_to_merge)) { + throw new \InvalidArgumentException('non-nullable object_id_to_merge cannot be null'); + } $this->container['object_id_to_merge'] = $object_id_to_merge; return $this; @@ -258,6 +348,9 @@ public function getPrimaryObjectId() */ public function setPrimaryObjectId($primary_object_id) { + if (is_null($primary_object_id)) { + throw new \InvalidArgumentException('non-nullable primary_object_id cannot be null'); + } $this->container['primary_object_id'] = $primary_object_id; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php index 89ee2ba71..99a5da991 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class PublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php b/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php index 98ab37c4f..edd24a2b4 100644 --- a/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Objects/Taxes/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class PublicObjectSearchRequest implements ModelInterface, ArrayAccess, \JsonSer 'filter_groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'limit' => false, + 'after' => false, + 'sorts' => false, + 'properties' => false, + 'filter_groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['query'] = $data['query'] ?? null; - $this->container['limit'] = $data['limit'] ?? null; - $this->container['after'] = $data['after'] ?? null; - $this->container['sorts'] = $data['sorts'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['filter_groups'] = $data['filter_groups'] ?? null; + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('sorts', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('filter_groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,6 +358,9 @@ public function getQuery() */ public function setQuery($query) { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } $this->container['query'] = $query; return $this; @@ -291,6 +385,9 @@ public function getLimit() */ public function setLimit($limit) { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } $this->container['limit'] = $limit; return $this; @@ -315,6 +412,9 @@ public function getAfter() */ public function setAfter($after) { + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); + } $this->container['after'] = $after; return $this; @@ -339,6 +439,9 @@ public function getSorts() */ public function setSorts($sorts) { + if (is_null($sorts)) { + throw new \InvalidArgumentException('non-nullable sorts cannot be null'); + } $this->container['sorts'] = $sorts; return $this; @@ -363,6 +466,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -387,6 +493,9 @@ public function getFilterGroups() */ public function setFilterGroups($filter_groups) { + if (is_null($filter_groups)) { + throw new \InvalidArgumentException('non-nullable filter_groups cannot be null'); + } $this->container['filter_groups'] = $filter_groups; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php index 1e273ade4..dc22dd350 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -83,6 +83,28 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +125,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -206,13 +280,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -270,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -294,6 +389,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -318,6 +416,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -342,6 +443,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -366,6 +470,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -390,6 +497,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -414,6 +524,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php index a73dd69fb..ce53fb5f4 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -75,6 +75,24 @@ class SimplePublicObjectBatchInput implements ModelInterface, ArrayAccess, \Json 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id_property' => false, + 'id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +113,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -186,9 +256,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id_property'] = $data['id_property'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('id_property', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -240,6 +328,9 @@ public function getIdProperty() */ public function setIdProperty($id_property) { + if (is_null($id_property)) { + throw new \InvalidArgumentException('non-nullable id_property cannot be null'); + } $this->container['id_property'] = $id_property; return $this; @@ -264,6 +355,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -288,6 +382,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php index 58bca6cce..538b7295a 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectId implements ModelInterface, ArrayAccess, \JsonSerializ 'id' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php index 2f8bd99c3..eaae0e749 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -71,6 +71,22 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -91,6 +107,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -176,7 +244,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,6 +311,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php index ccd4c3a52..abd8af7cd 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -73,6 +73,23 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ 'properties' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +110,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -181,8 +250,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -234,6 +321,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -258,6 +348,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php index 39b876df6..9867054b4 100644 --- a/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Taxes/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'updated_at' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'created_at' => false, + 'archived' => false, + 'archived_at' => false, + 'properties_with_history' => false, + 'id' => false, + 'properties' => false, + 'updated_at' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['associations'] = $data['associations'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['archived'] = $data['archived'] ?? null; - $this->container['archived_at'] = $data['archived_at'] ?? null; - $this->container['properties_with_history'] = $data['properties_with_history'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['properties'] = $data['properties'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->setIfExists('associations', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('properties_with_history', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -276,6 +369,9 @@ public function getAssociations() */ public function setAssociations($associations) { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } $this->container['associations'] = $associations; return $this; @@ -300,6 +396,9 @@ public function getCreatedAt() */ public function setCreatedAt($created_at) { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -324,6 +423,9 @@ public function getArchived() */ public function setArchived($archived) { + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); + } $this->container['archived'] = $archived; return $this; @@ -348,6 +450,9 @@ public function getArchivedAt() */ public function setArchivedAt($archived_at) { + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + } $this->container['archived_at'] = $archived_at; return $this; @@ -372,6 +477,9 @@ public function getPropertiesWithHistory() */ public function setPropertiesWithHistory($properties_with_history) { + if (is_null($properties_with_history)) { + throw new \InvalidArgumentException('non-nullable properties_with_history cannot be null'); + } $this->container['properties_with_history'] = $properties_with_history; return $this; @@ -396,6 +504,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -420,6 +531,9 @@ public function getProperties() */ public function setProperties($properties) { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } $this->container['properties'] = $properties; return $this; @@ -444,6 +558,9 @@ public function getUpdatedAt() */ public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/StandardError.php b/codegen/Crm/Objects/Taxes/Model/StandardError.php index 01630c721..dc731b923 100644 --- a/codegen/Crm/Objects/Taxes/Model/StandardError.php +++ b/codegen/Crm/Objects/Taxes/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -85,6 +85,29 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable 'status' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sub_category' => false, + 'context' => false, + 'links' => false, + 'id' => false, + 'category' => false, + 'message' => false, + 'errors' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +128,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -211,14 +286,32 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['sub_category'] = $data['sub_category'] ?? null; - $this->container['context'] = $data['context'] ?? null; - $this->container['links'] = $data['links'] ?? null; - $this->container['id'] = $data['id'] ?? null; - $this->container['category'] = $data['category'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['status'] = $data['status'] ?? null; + $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -282,6 +375,9 @@ public function getSubCategory() */ public function setSubCategory($sub_category) { + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + } $this->container['sub_category'] = $sub_category; return $this; @@ -306,6 +402,9 @@ public function getContext() */ public function setContext($context) { + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); + } $this->container['context'] = $context; return $this; @@ -330,6 +429,9 @@ public function getLinks() */ public function setLinks($links) { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } $this->container['links'] = $links; return $this; @@ -354,6 +456,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -378,6 +483,9 @@ public function getCategory() */ public function setCategory($category) { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } $this->container['category'] = $category; return $this; @@ -402,6 +510,9 @@ public function getMessage() */ public function setMessage($message) { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -426,6 +537,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -450,6 +564,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; diff --git a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php index 941b2fd70..573eadbdb 100644 --- a/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Objects/Taxes/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -81,6 +81,27 @@ class ValueWithTimestamp implements ModelInterface, ArrayAccess, \JsonSerializab 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'source_id' => false, + 'source_type' => false, + 'source_label' => false, + 'updated_by_user_id' => false, + 'value' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +122,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -201,12 +274,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_id'] = $data['source_id'] ?? null; - $this->container['source_type'] = $data['source_type'] ?? null; - $this->container['source_label'] = $data['source_label'] ?? null; - $this->container['updated_by_user_id'] = $data['updated_by_user_id'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('source_id', $data ?? [], null); + $this->setIfExists('source_type', $data ?? [], null); + $this->setIfExists('source_label', $data ?? [], null); + $this->setIfExists('updated_by_user_id', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -261,6 +352,9 @@ public function getSourceId() */ public function setSourceId($source_id) { + if (is_null($source_id)) { + throw new \InvalidArgumentException('non-nullable source_id cannot be null'); + } $this->container['source_id'] = $source_id; return $this; @@ -285,6 +379,9 @@ public function getSourceType() */ public function setSourceType($source_type) { + if (is_null($source_type)) { + throw new \InvalidArgumentException('non-nullable source_type cannot be null'); + } $this->container['source_type'] = $source_type; return $this; @@ -309,6 +406,9 @@ public function getSourceLabel() */ public function setSourceLabel($source_label) { + if (is_null($source_label)) { + throw new \InvalidArgumentException('non-nullable source_label cannot be null'); + } $this->container['source_label'] = $source_label; return $this; @@ -333,6 +433,9 @@ public function getUpdatedByUserId() */ public function setUpdatedByUserId($updated_by_user_id) { + if (is_null($updated_by_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_by_user_id cannot be null'); + } $this->container['updated_by_user_id'] = $updated_by_user_id; return $this; @@ -357,6 +460,9 @@ public function getValue() */ public function setValue($value) { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -381,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; diff --git a/codegen/Crm/Objects/Taxes/ObjectSerializer.php b/codegen/Crm/Objects/Taxes/ObjectSerializer.php index f3085cc27..c6bb51837 100644 --- a/codegen/Crm/Objects/Taxes/ObjectSerializer.php +++ b/codegen/Crm/Objects/Taxes/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 6.0.1 + * OpenAPI Generator version: 7.3.0 */ /** @@ -87,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -157,6 +157,49 @@ public static function toPathValue($value) return rawurlencode(self::toString($value)); } + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + /** * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. @@ -178,10 +221,12 @@ public static function toQueryValue( bool $explode = true, bool $required = true ): array { - if ( - empty($value) - && ($value !== false || $openApiType !== 'boolean') // if $value === false and $openApiType ==='boolean' it isn't empty - ) { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { if ($required) { return ["{$paramName}" => '']; } else { @@ -189,6 +234,11 @@ public static function toQueryValue( } } + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + $query = []; $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; @@ -395,7 +445,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -405,7 +455,7 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved return new \DateTime(self::sanitizeTimestamp($data)); @@ -441,7 +491,7 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; } @@ -455,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -469,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; }