From c405e45016bf576d10076c23e3156ce7dcdfe416 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Wed, 11 Feb 2026 17:29:54 +0300 Subject: [PATCH] Codegen: CRM Properties --- codegen/Crm/Properties/Api/BatchApi.php | 414 +++----- codegen/Crm/Properties/Api/CoreApi.php | 671 ++++++------- codegen/Crm/Properties/Api/GroupsApi.php | 621 +++++------- codegen/Crm/Properties/ApiException.php | 4 +- codegen/Crm/Properties/Configuration.php | 63 +- codegen/Crm/Properties/FormDataProcessor.php | 246 +++++ codegen/Crm/Properties/HeaderSelector.php | 4 +- .../Model/BatchInputPropertyCreate.php | 16 +- .../Model/BatchInputPropertyName.php | 16 +- .../Model/BatchReadInputPropertyName.php | 89 +- .../Model/BatchResponseProperty.php | 186 ++-- .../Model/BatchResponsePropertyWithErrors.php | 697 -------------- ...ollectionResponsePropertyGroupNoPaging.php | 16 +- .../CollectionResponsePropertyNoPaging.php | 16 +- codegen/Crm/Properties/Model/Error.php | 158 ++-- codegen/Crm/Properties/Model/ErrorDetail.php | 134 +-- .../Crm/Properties/Model/ModelInterface.php | 4 +- codegen/Crm/Properties/Model/Option.php | 89 +- codegen/Crm/Properties/Model/OptionInput.php | 88 +- codegen/Crm/Properties/Model/Property.php | 891 +++++++++++------- .../Crm/Properties/Model/PropertyCreate.php | 542 ++++++----- .../Crm/Properties/Model/PropertyGroup.php | 102 +- .../Properties/Model/PropertyGroupCreate.php | 102 +- .../Properties/Model/PropertyGroupUpdate.php | 16 +- .../Model/PropertyModificationMetadata.php | 140 +-- codegen/Crm/Properties/Model/PropertyName.php | 16 +- .../Crm/Properties/Model/PropertyUpdate.php | 428 ++++----- .../Crm/Properties/Model/StandardError.php | 203 ++-- codegen/Crm/Properties/ObjectSerializer.php | 24 +- 29 files changed, 2788 insertions(+), 3208 deletions(-) create mode 100644 codegen/Crm/Properties/FormDataProcessor.php delete mode 100644 codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php diff --git a/codegen/Crm/Properties/Api/BatchApi.php b/codegen/Crm/Properties/Api/BatchApi.php index 48d726e6..a5d3f3e4 100644 --- a/codegen/Crm/Properties/Api/BatchApi.php +++ b/codegen/Crm/Properties/Api/BatchApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -197,8 +199,10 @@ public function archiveWithHttpInfo($object_type, $batch_input_property_name, st $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -208,7 +212,7 @@ public function archiveWithHttpInfo($object_type, $batch_input_property_name, st * * Archive a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyName $batch_input_property_name (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -230,7 +234,7 @@ function ($response) { * * Archive a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyName $batch_input_property_name (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -268,7 +272,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyName $batch_input_property_name (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -381,13 +385,13 @@ public function archiveRequest($object_type, $batch_input_property_name, string * * Create a batch of properties * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyCreate $batch_input_property_create batch_input_property_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\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors|\HubSpot\Client\Crm\Properties\Model\Error + * @return \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\Error */ public function create($object_type, $batch_input_property_create, string $contentType = self::contentTypes['create'][0]) { @@ -400,13 +404,13 @@ public function create($object_type, $batch_input_property_create, string $conte * * Create a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyCreate $batch_input_property_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\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function createWithHttpInfo($object_type, $batch_input_property_create, string $contentType = self::contentTypes['create'][0]) { @@ -436,89 +440,22 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s switch($statusCode) { - case 201: - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 207: - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + case 200: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -532,52 +469,21 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', $e->getResponseHeaders() ); $e->setResponseObject($data); - break; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -585,8 +491,10 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -596,7 +504,7 @@ public function createWithHttpInfo($object_type, $batch_input_property_create, s * * Create a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyCreate $batch_input_property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -618,7 +526,7 @@ function ($response) { * * Create a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyCreate $batch_input_property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -669,7 +577,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchInputPropertyCreate $batch_input_property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -782,17 +690,18 @@ public function createRequest($object_type, $batch_input_property_create, string * * Read a batch of properties * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchReadInputPropertyName $batch_read_input_property_name batch_read_input_property_name (required) + * @param string|null $locale (optional) * @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\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors|\HubSpot\Client\Crm\Properties\Model\Error + * @return \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\Error */ - public function read($object_type, $batch_read_input_property_name, string $contentType = self::contentTypes['read'][0]) + public function read($object_type, $batch_read_input_property_name, $locale = null, string $contentType = self::contentTypes['read'][0]) { - list($response) = $this->readWithHttpInfo($object_type, $batch_read_input_property_name, $contentType); + list($response) = $this->readWithHttpInfo($object_type, $batch_read_input_property_name, $locale, $contentType); return $response; } @@ -801,17 +710,18 @@ public function read($object_type, $batch_read_input_property_name, string $cont * * Read a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchReadInputPropertyName $batch_read_input_property_name (required) + * @param string|null $locale (optional) * @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\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Properties\Model\BatchResponseProperty|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function readWithHttpInfo($object_type, $batch_read_input_property_name, string $contentType = self::contentTypes['read'][0]) + public function readWithHttpInfo($object_type, $batch_read_input_property_name, $locale = null, string $contentType = self::contentTypes['read'][0]) { - $request = $this->readRequest($object_type, $batch_read_input_property_name, $contentType); + $request = $this->readRequest($object_type, $batch_read_input_property_name, $locale, $contentType); try { $options = $this->createHttpClientOption(); @@ -838,88 +748,21 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 207: - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -933,34 +776,11 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -970,15 +790,7 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; - case 207: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Properties\Model\BatchResponsePropertyWithErrors', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -986,8 +798,10 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -997,16 +811,17 @@ public function readWithHttpInfo($object_type, $batch_read_input_property_name, * * Read a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchReadInputPropertyName $batch_read_input_property_name (required) + * @param string|null $locale (optional) * @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($object_type, $batch_read_input_property_name, string $contentType = self::contentTypes['read'][0]) + public function readAsync($object_type, $batch_read_input_property_name, $locale = null, string $contentType = self::contentTypes['read'][0]) { - return $this->readAsyncWithHttpInfo($object_type, $batch_read_input_property_name, $contentType) + return $this->readAsyncWithHttpInfo($object_type, $batch_read_input_property_name, $locale, $contentType) ->then( function ($response) { return $response[0]; @@ -1019,17 +834,18 @@ function ($response) { * * Read a batch of properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchReadInputPropertyName $batch_read_input_property_name (required) + * @param string|null $locale (optional) * @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($object_type, $batch_read_input_property_name, string $contentType = self::contentTypes['read'][0]) + public function readAsyncWithHttpInfo($object_type, $batch_read_input_property_name, $locale = null, string $contentType = self::contentTypes['read'][0]) { $returnType = '\HubSpot\Client\Crm\Properties\Model\BatchResponseProperty'; - $request = $this->readRequest($object_type, $batch_read_input_property_name, $contentType); + $request = $this->readRequest($object_type, $batch_read_input_property_name, $locale, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1070,14 +886,15 @@ function ($exception) { /** * Create request for operation 'read' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\BatchReadInputPropertyName $batch_read_input_property_name (required) + * @param string|null $locale (optional) * @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($object_type, $batch_read_input_property_name, string $contentType = self::contentTypes['read'][0]) + public function readRequest($object_type, $batch_read_input_property_name, $locale = null, string $contentType = self::contentTypes['read'][0]) { // verify the required parameter 'object_type' is set @@ -1095,6 +912,7 @@ public function readRequest($object_type, $batch_read_input_property_name, strin } + $resourcePath = '/crm/v3/properties/{objectType}/batch/read'; $formParams = []; $queryParams = []; @@ -1102,6 +920,15 @@ public function readRequest($object_type, $batch_read_input_property_name, strin $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $locale, + 'locale', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1194,6 +1021,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Properties/Api/CoreApi.php b/codegen/Crm/Properties/Api/CoreApi.php index 62785ee8..73b49873 100644 --- a/codegen/Crm/Properties/Api/CoreApi.php +++ b/codegen/Crm/Properties/Api/CoreApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -203,8 +205,10 @@ public function archiveWithHttpInfo($object_type, $property_name, string $conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -214,8 +218,8 @@ public function archiveWithHttpInfo($object_type, $property_name, string $conten * * Archive a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (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 @@ -236,8 +240,8 @@ function ($response) { * * Archive a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (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 @@ -274,8 +278,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (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 @@ -388,7 +392,7 @@ public function archiveRequest($object_type, $property_name, string $contentType * * Create a property * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyCreate $property_create property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -407,7 +411,7 @@ public function create($object_type, $property_create, string $contentType = sel * * Create a property * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyCreate $property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -444,61 +448,21 @@ public function createWithHttpInfo($object_type, $property_create, string $conte switch($statusCode) { case 201: - if ('\HubSpot\Client\Crm\Properties\Model\Property' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Property' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Property', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -512,34 +476,11 @@ public function createWithHttpInfo($object_type, $property_create, string $conte ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -549,7 +490,7 @@ public function createWithHttpInfo($object_type, $property_create, string $conte $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -557,8 +498,10 @@ public function createWithHttpInfo($object_type, $property_create, string $conte $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -568,7 +511,7 @@ public function createWithHttpInfo($object_type, $property_create, string $conte * * Create a property * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyCreate $property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -590,7 +533,7 @@ function ($response) { * * Create a property * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyCreate $property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -641,7 +584,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyCreate $property_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -754,18 +697,20 @@ public function createRequest($object_type, $property_create, string $contentTyp * * Read all properties * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging|\HubSpot\Client\Crm\Properties\Model\Error */ - public function getAll($object_type, $archived = false, $properties = null, string $contentType = self::contentTypes['getAll'][0]) + public function getAll($object_type, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->getAllWithHttpInfo($object_type, $archived, $properties, $contentType); + list($response) = $this->getAllWithHttpInfo($object_type, $archived, $properties, $data_sensitivity, $locale, $contentType); return $response; } @@ -774,18 +719,20 @@ public function getAll($object_type, $archived = false, $properties = null, stri * * Read all properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getAllWithHttpInfo($object_type, $archived = false, $properties = null, string $contentType = self::contentTypes['getAll'][0]) + public function getAllWithHttpInfo($object_type, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->getAllRequest($object_type, $archived, $properties, $contentType); + $request = $this->getAllRequest($object_type, $archived, $properties, $data_sensitivity, $locale, $contentType); try { $options = $this->createHttpClientOption(); @@ -812,61 +759,21 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -880,34 +787,11 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -917,7 +801,7 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -925,8 +809,10 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -936,17 +822,19 @@ public function getAllWithHttpInfo($object_type, $archived = false, $properties * * Read all properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsync($object_type, $archived = false, $properties = null, string $contentType = self::contentTypes['getAll'][0]) + public function getAllAsync($object_type, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - return $this->getAllAsyncWithHttpInfo($object_type, $archived, $properties, $contentType) + return $this->getAllAsyncWithHttpInfo($object_type, $archived, $properties, $data_sensitivity, $locale, $contentType) ->then( function ($response) { return $response[0]; @@ -959,18 +847,20 @@ function ($response) { * * Read all properties * - * @param string $object_type (required) + * @param string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsyncWithHttpInfo($object_type, $archived = false, $properties = null, string $contentType = self::contentTypes['getAll'][0]) + public function getAllAsyncWithHttpInfo($object_type, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getAll'][0]) { $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyNoPaging'; - $request = $this->getAllRequest($object_type, $archived, $properties, $contentType); + $request = $this->getAllRequest($object_type, $archived, $properties, $data_sensitivity, $locale, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1011,15 +901,17 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $object_type (required) + * @param string $object_type (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAllRequest($object_type, $archived = false, $properties = null, string $contentType = self::contentTypes['getAll'][0]) + public function getAllRequest($object_type, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getAll'][0]) { // verify the required parameter 'object_type' is set @@ -1032,6 +924,8 @@ public function getAllRequest($object_type, $archived = false, $properties = nul + + $resourcePath = '/crm/v3/properties/{objectType}'; $formParams = []; $queryParams = []; @@ -1057,6 +951,24 @@ public function getAllRequest($object_type, $archived = false, $properties = nul true, // explode false // required ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $data_sensitivity, + 'dataSensitivity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $locale, + 'locale', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1131,19 +1043,21 @@ public function getAllRequest($object_type, $archived = false, $properties = nul * * Read a property * - * @param string $object_type object_type (required) - * @param string $property_name property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Properties\Model\Property|\HubSpot\Client\Crm\Properties\Model\Error */ - public function getByName($object_type, $property_name, $archived = false, $properties = null, string $contentType = self::contentTypes['getByName'][0]) + public function getByName($object_type, $property_name, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - list($response) = $this->getByNameWithHttpInfo($object_type, $property_name, $archived, $properties, $contentType); + list($response) = $this->getByNameWithHttpInfo($object_type, $property_name, $archived, $properties, $data_sensitivity, $locale, $contentType); return $response; } @@ -1152,19 +1066,21 @@ public function getByName($object_type, $property_name, $archived = false, $prop * * Read a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Properties\Model\Property|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByNameWithHttpInfo($object_type, $property_name, $archived = false, $properties = null, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameWithHttpInfo($object_type, $property_name, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - $request = $this->getByNameRequest($object_type, $property_name, $archived, $properties, $contentType); + $request = $this->getByNameRequest($object_type, $property_name, $archived, $properties, $data_sensitivity, $locale, $contentType); try { $options = $this->createHttpClientOption(); @@ -1191,61 +1107,21 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\Property' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Property' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Property', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1259,34 +1135,11 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1296,7 +1149,7 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1304,8 +1157,10 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1315,18 +1170,20 @@ public function getByNameWithHttpInfo($object_type, $property_name, $archived = * * Read a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByNameAsync($object_type, $property_name, $archived = false, $properties = null, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameAsync($object_type, $property_name, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - return $this->getByNameAsyncWithHttpInfo($object_type, $property_name, $archived, $properties, $contentType) + return $this->getByNameAsyncWithHttpInfo($object_type, $property_name, $archived, $properties, $data_sensitivity, $locale, $contentType) ->then( function ($response) { return $response[0]; @@ -1339,19 +1196,21 @@ function ($response) { * * Read a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByNameAsyncWithHttpInfo($object_type, $property_name, $archived = false, $properties = null, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameAsyncWithHttpInfo($object_type, $property_name, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getByName'][0]) { $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; - $request = $this->getByNameRequest($object_type, $property_name, $archived, $properties, $contentType); + $request = $this->getByNameRequest($object_type, $property_name, $archived, $properties, $data_sensitivity, $locale, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1392,16 +1251,18 @@ function ($exception) { /** * Create request for operation 'getByName' * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $properties (optional) + * @param string|null $properties (optional) + * @param string|null $data_sensitivity (optional, default to 'non_sensitive') + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByNameRequest($object_type, $property_name, $archived = false, $properties = null, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameRequest($object_type, $property_name, $archived = false, $properties = null, $data_sensitivity = 'non_sensitive', $locale = null, string $contentType = self::contentTypes['getByName'][0]) { // verify the required parameter 'object_type' is set @@ -1421,6 +1282,8 @@ public function getByNameRequest($object_type, $property_name, $archived = false + + $resourcePath = '/crm/v3/properties/{objectType}/{propertyName}'; $formParams = []; $queryParams = []; @@ -1446,6 +1309,24 @@ public function getByNameRequest($object_type, $property_name, $archived = false true, // explode false // required ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $data_sensitivity, + 'dataSensitivity', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $locale, + 'locale', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1528,8 +1409,8 @@ public function getByNameRequest($object_type, $property_name, $archived = false * * Update a property * - * @param string $object_type object_type (required) - * @param string $property_name property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyUpdate $property_update property_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1548,8 +1429,8 @@ public function update($object_type, $property_name, $property_update, string $c * * Update a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyUpdate $property_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1586,61 +1467,21 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\Property' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Property' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Property', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1654,34 +1495,11 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\Property'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Property', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1691,7 +1509,7 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1699,8 +1517,10 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1710,8 +1530,8 @@ public function updateWithHttpInfo($object_type, $property_name, $property_updat * * Update a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyUpdate $property_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1733,8 +1553,8 @@ function ($response) { * * Update a property * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyUpdate $property_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1785,8 +1605,8 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $object_type (required) - * @param string $property_name (required) + * @param string $object_type (required) + * @param string $property_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyUpdate $property_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1925,6 +1745,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Properties/Api/GroupsApi.php b/codegen/Crm/Properties/Api/GroupsApi.php index 96617cd3..0e3ac0dd 100644 --- a/codegen/Crm/Properties/Api/GroupsApi.php +++ b/codegen/Crm/Properties/Api/GroupsApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -203,8 +205,10 @@ public function archiveWithHttpInfo($object_type, $group_name, string $contentTy $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -214,8 +218,8 @@ public function archiveWithHttpInfo($object_type, $group_name, string $contentTy * * Archive a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (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 @@ -236,8 +240,8 @@ function ($response) { * * Archive a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (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 @@ -274,8 +278,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (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 @@ -388,7 +392,7 @@ public function archiveRequest($object_type, $group_name, string $contentType = * * Create a property group * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create property_group_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -407,7 +411,7 @@ public function create($object_type, $property_group_create, string $contentType * * Create a property group * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -444,61 +448,21 @@ public function createWithHttpInfo($object_type, $property_group_create, string switch($statusCode) { case 201: - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -512,34 +476,11 @@ public function createWithHttpInfo($object_type, $property_group_create, string ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -549,7 +490,7 @@ public function createWithHttpInfo($object_type, $property_group_create, string $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -557,8 +498,10 @@ public function createWithHttpInfo($object_type, $property_group_create, string $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -568,7 +511,7 @@ public function createWithHttpInfo($object_type, $property_group_create, string * * Create a property group * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -590,7 +533,7 @@ function ($response) { * * Create a property group * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -641,7 +584,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupCreate $property_group_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -754,16 +697,17 @@ public function createRequest($object_type, $property_group_create, string $cont * * Read all property groups * - * @param string $object_type object_type (required) + * @param string $object_type (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging|\HubSpot\Client\Crm\Properties\Model\Error */ - public function getAll($object_type, string $contentType = self::contentTypes['getAll'][0]) + public function getAll($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - list($response) = $this->getAllWithHttpInfo($object_type, $contentType); + list($response) = $this->getAllWithHttpInfo($object_type, $locale, $contentType); return $response; } @@ -772,16 +716,17 @@ public function getAll($object_type, string $contentType = self::contentTypes['g * * Read all property groups * - * @param string $object_type (required) + * @param string $object_type (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getAllWithHttpInfo($object_type, string $contentType = self::contentTypes['getAll'][0]) + public function getAllWithHttpInfo($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - $request = $this->getAllRequest($object_type, $contentType); + $request = $this->getAllRequest($object_type, $locale, $contentType); try { $options = $this->createHttpClientOption(); @@ -808,61 +753,21 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -876,34 +781,11 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -913,7 +795,7 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -921,8 +803,10 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -932,15 +816,16 @@ public function getAllWithHttpInfo($object_type, string $contentType = self::con * * Read all property groups * - * @param string $object_type (required) + * @param string $object_type (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsync($object_type, string $contentType = self::contentTypes['getAll'][0]) + public function getAllAsync($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) { - return $this->getAllAsyncWithHttpInfo($object_type, $contentType) + return $this->getAllAsyncWithHttpInfo($object_type, $locale, $contentType) ->then( function ($response) { return $response[0]; @@ -953,16 +838,17 @@ function ($response) { * * Read all property groups * - * @param string $object_type (required) + * @param string $object_type (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAllAsyncWithHttpInfo($object_type, string $contentType = self::contentTypes['getAll'][0]) + public function getAllAsyncWithHttpInfo($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) { $returnType = '\HubSpot\Client\Crm\Properties\Model\CollectionResponsePropertyGroupNoPaging'; - $request = $this->getAllRequest($object_type, $contentType); + $request = $this->getAllRequest($object_type, $locale, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1003,13 +889,14 @@ function ($exception) { /** * Create request for operation 'getAll' * - * @param string $object_type (required) + * @param string $object_type (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAll'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAllRequest($object_type, string $contentType = self::contentTypes['getAll'][0]) + public function getAllRequest($object_type, $locale = null, string $contentType = self::contentTypes['getAll'][0]) { // verify the required parameter 'object_type' is set @@ -1020,6 +907,7 @@ public function getAllRequest($object_type, string $contentType = self::contentT } + $resourcePath = '/crm/v3/properties/{objectType}/groups'; $formParams = []; $queryParams = []; @@ -1027,6 +915,15 @@ public function getAllRequest($object_type, string $contentType = self::contentT $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $locale, + 'locale', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1101,17 +998,18 @@ public function getAllRequest($object_type, string $contentType = self::contentT * * Read a property group * - * @param string $object_type object_type (required) - * @param string $group_name group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error */ - public function getByName($object_type, $group_name, string $contentType = self::contentTypes['getByName'][0]) + public function getByName($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - list($response) = $this->getByNameWithHttpInfo($object_type, $group_name, $contentType); + list($response) = $this->getByNameWithHttpInfo($object_type, $group_name, $locale, $contentType); return $response; } @@ -1120,17 +1018,18 @@ public function getByName($object_type, $group_name, string $contentType = self: * * Read a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Properties\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Properties\Model\PropertyGroup|\HubSpot\Client\Crm\Properties\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function getByNameWithHttpInfo($object_type, $group_name, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameWithHttpInfo($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - $request = $this->getByNameRequest($object_type, $group_name, $contentType); + $request = $this->getByNameRequest($object_type, $group_name, $locale, $contentType); try { $options = $this->createHttpClientOption(); @@ -1157,61 +1056,21 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1225,34 +1084,11 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1262,7 +1098,7 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1270,8 +1106,10 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1281,16 +1119,17 @@ public function getByNameWithHttpInfo($object_type, $group_name, string $content * * Read a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByNameAsync($object_type, $group_name, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameAsync($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) { - return $this->getByNameAsyncWithHttpInfo($object_type, $group_name, $contentType) + return $this->getByNameAsyncWithHttpInfo($object_type, $group_name, $locale, $contentType) ->then( function ($response) { return $response[0]; @@ -1303,17 +1142,18 @@ function ($response) { * * Read a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getByNameAsyncWithHttpInfo($object_type, $group_name, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameAsyncWithHttpInfo($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) { $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - $request = $this->getByNameRequest($object_type, $group_name, $contentType); + $request = $this->getByNameRequest($object_type, $group_name, $locale, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1354,14 +1194,15 @@ function ($exception) { /** * Create request for operation 'getByName' * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) + * @param string|null $locale (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getByName'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getByNameRequest($object_type, $group_name, string $contentType = self::contentTypes['getByName'][0]) + public function getByNameRequest($object_type, $group_name, $locale = null, string $contentType = self::contentTypes['getByName'][0]) { // verify the required parameter 'object_type' is set @@ -1379,6 +1220,7 @@ public function getByNameRequest($object_type, $group_name, string $contentType } + $resourcePath = '/crm/v3/properties/{objectType}/groups/{groupName}'; $formParams = []; $queryParams = []; @@ -1386,6 +1228,15 @@ public function getByNameRequest($object_type, $group_name, string $contentType $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $locale, + 'locale', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1468,8 +1319,8 @@ public function getByNameRequest($object_type, $group_name, string $contentType * * Update a property group * - * @param string $object_type object_type (required) - * @param string $group_name group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update property_group_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1488,8 +1339,8 @@ public function update($object_type, $group_name, $property_group_update, string * * Update a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1526,61 +1377,21 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\PropertyGroup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Properties\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Properties\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Properties\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1594,34 +1405,11 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up ); } - $returnType = '\HubSpot\Client\Crm\Properties\Model\PropertyGroup'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Properties\Model\PropertyGroup', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1631,7 +1419,7 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1639,8 +1427,10 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1650,8 +1440,8 @@ public function updateWithHttpInfo($object_type, $group_name, $property_group_up * * Update a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1673,8 +1463,8 @@ function ($response) { * * Update a property group * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1725,8 +1515,8 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $object_type (required) - * @param string $group_name (required) + * @param string $object_type (required) + * @param string $group_name (required) * @param \HubSpot\Client\Crm\Properties\Model\PropertyGroupUpdate $property_group_update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1865,6 +1655,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Properties/ApiException.php b/codegen/Crm/Properties/ApiException.php index 1c8fcede..64e06773 100644 --- a/codegen/Crm/Properties/ApiException.php +++ b/codegen/Crm/Properties/ApiException.php @@ -1,7 +1,7 @@ tempFolderPath; } + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + /** * Gets the default configuration instance * diff --git a/codegen/Crm/Properties/FormDataProcessor.php b/codegen/Crm/Properties/FormDataProcessor.php new file mode 100644 index 00000000..af79674e --- /dev/null +++ b/codegen/Crm/Properties/FormDataProcessor.php @@ -0,0 +1,246 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/codegen/Crm/Properties/HeaderSelector.php b/codegen/Crm/Properties/HeaderSelector.php index 46429c12..29f52b4e 100644 --- a/codegen/Crm/Properties/HeaderSelector.php +++ b/codegen/Crm/Properties/HeaderSelector.php @@ -1,7 +1,7 @@ container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/BatchInputPropertyName.php b/codegen/Crm/Properties/Model/BatchInputPropertyName.php index 50c471d9..a6864474 100644 --- a/codegen/Crm/Properties/Model/BatchInputPropertyName.php +++ b/codegen/Crm/Properties/Model/BatchInputPropertyName.php @@ -2,7 +2,7 @@ /** * BatchInputPropertyName * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -321,11 +321,11 @@ public function setInputs($inputs) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php b/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php index e8baca23..610a1cc1 100644 --- a/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php +++ b/codegen/Crm/Properties/Model/BatchReadInputPropertyName.php @@ -2,7 +2,7 @@ /** * BatchReadInputPropertyName * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,6 +58,7 @@ class BatchReadInputPropertyName implements ModelInterface, ArrayAccess, \JsonSe */ protected static $openAPITypes = [ 'archived' => 'bool', + 'data_sensitivity' => 'string', 'inputs' => '\HubSpot\Client\Crm\Properties\Model\PropertyName[]' ]; @@ -70,6 +71,7 @@ class BatchReadInputPropertyName implements ModelInterface, ArrayAccess, \JsonSe */ protected static $openAPIFormats = [ 'archived' => null, + 'data_sensitivity' => null, 'inputs' => null ]; @@ -80,6 +82,7 @@ class BatchReadInputPropertyName implements ModelInterface, ArrayAccess, \JsonSe */ protected static array $openAPINullables = [ 'archived' => false, + 'data_sensitivity' => false, 'inputs' => false ]; @@ -170,6 +173,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'archived' => 'archived', + 'data_sensitivity' => 'dataSensitivity', 'inputs' => 'inputs' ]; @@ -180,6 +184,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'archived' => 'setArchived', + 'data_sensitivity' => 'setDataSensitivity', 'inputs' => 'setInputs' ]; @@ -190,6 +195,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'archived' => 'getArchived', + 'data_sensitivity' => 'getDataSensitivity', 'inputs' => 'getInputs' ]; @@ -234,6 +240,23 @@ public function getModelName() return self::$openAPIModelName; } + public const DATA_SENSITIVITY_HIGHLY_SENSITIVE = 'highly_sensitive'; + public const DATA_SENSITIVITY_NON_SENSITIVE = 'non_sensitive'; + public const DATA_SENSITIVITY_SENSITIVE = 'sensitive'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataSensitivityAllowableValues() + { + return [ + self::DATA_SENSITIVITY_HIGHLY_SENSITIVE, + self::DATA_SENSITIVITY_NON_SENSITIVE, + self::DATA_SENSITIVITY_SENSITIVE, + ]; + } /** * Associative array for storing property values @@ -251,6 +274,7 @@ public function getModelName() public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('data_sensitivity', $data ?? [], null); $this->setIfExists('inputs', $data ?? [], null); } @@ -284,6 +308,18 @@ public function listInvalidProperties() if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } + if ($this->container['data_sensitivity'] === null) { + $invalidProperties[] = "'data_sensitivity' can't be null"; + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!is_null($this->container['data_sensitivity']) && !in_array($this->container['data_sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $this->container['data_sensitivity'], + implode("', '", $allowedValues) + ); + } + if ($this->container['inputs'] === null) { $invalidProperties[] = "'inputs' can't be null"; } @@ -329,6 +365,43 @@ public function setArchived($archived) return $this; } + /** + * Gets data_sensitivity + * + * @return string + */ + public function getDataSensitivity() + { + return $this->container['data_sensitivity']; + } + + /** + * Sets data_sensitivity + * + * @param string $data_sensitivity data_sensitivity + * + * @return self + */ + public function setDataSensitivity($data_sensitivity) + { + if (is_null($data_sensitivity)) { + throw new \InvalidArgumentException('non-nullable data_sensitivity cannot be null'); + } + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!in_array($data_sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $data_sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_sensitivity'] = $data_sensitivity; + + return $this; + } + /** * Gets inputs * @@ -358,11 +431,11 @@ public function setInputs($inputs) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -370,12 +443,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -400,11 +473,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/BatchResponseProperty.php b/codegen/Crm/Properties/Model/BatchResponseProperty.php index e224734c..2fa021c8 100644 --- a/codegen/Crm/Properties/Model/BatchResponseProperty.php +++ b/codegen/Crm/Properties/Model/BatchResponseProperty.php @@ -2,7 +2,7 @@ /** * BatchResponseProperty * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,10 +58,12 @@ class BatchResponseProperty implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static $openAPITypes = [ 'completed_at' => '\DateTime', - 'requested_at' => '\DateTime', - 'started_at' => '\DateTime', + 'errors' => '\HubSpot\Client\Crm\Properties\Model\StandardError[]', 'links' => 'array', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', 'results' => '\HubSpot\Client\Crm\Properties\Model\Property[]', + 'started_at' => '\DateTime', 'status' => 'string' ]; @@ -74,10 +76,12 @@ class BatchResponseProperty implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static $openAPIFormats = [ 'completed_at' => 'date-time', - 'requested_at' => 'date-time', - 'started_at' => 'date-time', + 'errors' => null, 'links' => null, + 'num_errors' => 'int32', + 'requested_at' => 'date-time', 'results' => null, + 'started_at' => 'date-time', 'status' => null ]; @@ -88,10 +92,12 @@ class BatchResponseProperty implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'completed_at' => false, - 'requested_at' => false, - 'started_at' => false, + 'errors' => false, 'links' => false, + 'num_errors' => false, + 'requested_at' => false, 'results' => false, + 'started_at' => false, 'status' => false ]; @@ -182,10 +188,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'completed_at' => 'completedAt', - 'requested_at' => 'requestedAt', - 'started_at' => 'startedAt', + 'errors' => 'errors', 'links' => 'links', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', 'results' => 'results', + 'started_at' => 'startedAt', 'status' => 'status' ]; @@ -196,10 +204,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'completed_at' => 'setCompletedAt', - 'requested_at' => 'setRequestedAt', - 'started_at' => 'setStartedAt', + 'errors' => 'setErrors', 'links' => 'setLinks', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', 'results' => 'setResults', + 'started_at' => 'setStartedAt', 'status' => 'setStatus' ]; @@ -210,10 +220,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'completed_at' => 'getCompletedAt', - 'requested_at' => 'getRequestedAt', - 'started_at' => 'getStartedAt', + 'errors' => 'getErrors', 'links' => 'getLinks', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', 'results' => 'getResults', + 'started_at' => 'getStartedAt', 'status' => 'getStatus' ]; @@ -258,10 +270,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; public const STATUS_CANCELED = 'CANCELED'; public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; /** * Gets allowable values of the enum @@ -271,10 +283,10 @@ public function getModelName() public function getStatusAllowableValues() { return [ - self::STATUS_PENDING, - self::STATUS_PROCESSING, self::STATUS_CANCELED, self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, ]; } @@ -294,10 +306,12 @@ public function getStatusAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); - $this->setIfExists('requested_at', $data ?? [], null); - $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); } @@ -331,12 +345,12 @@ public function listInvalidProperties() if ($this->container['completed_at'] === null) { $invalidProperties[] = "'completed_at' can't be null"; } - if ($this->container['started_at'] === null) { - $invalidProperties[] = "'started_at' can't be null"; - } if ($this->container['results'] === null) { $invalidProperties[] = "'results' can't be null"; } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -392,82 +406,109 @@ public function setCompletedAt($completed_at) } /** - * Gets requested_at + * Gets errors * - * @return \DateTime|null + * @return \HubSpot\Client\Crm\Properties\Model\StandardError[]|null */ - public function getRequestedAt() + public function getErrors() { - return $this->container['requested_at']; + return $this->container['errors']; } /** - * Sets requested_at + * Sets errors * - * @param \DateTime|null $requested_at requested_at + * @param \HubSpot\Client\Crm\Properties\Model\StandardError[]|null $errors errors * * @return self */ - public function setRequestedAt($requested_at) + public function setErrors($errors) { - if (is_null($requested_at)) { - throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['requested_at'] = $requested_at; + $this->container['errors'] = $errors; return $this; } /** - * Gets started_at + * Gets links * - * @return \DateTime + * @return array|null */ - public function getStartedAt() + public function getLinks() { - return $this->container['started_at']; + return $this->container['links']; } /** - * Sets started_at + * Sets links * - * @param \DateTime $started_at started_at + * @param array|null $links links * * @return self */ - public function setStartedAt($started_at) + public function setLinks($links) { - if (is_null($started_at)) { - throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['started_at'] = $started_at; + $this->container['links'] = $links; return $this; } /** - * Gets links + * Gets num_errors * - * @return array|null + * @return int|null */ - public function getLinks() + public function getNumErrors() { - return $this->container['links']; + return $this->container['num_errors']; } /** - * Sets links + * Sets num_errors * - * @param array|null $links links + * @param int|null $num_errors num_errors * * @return self */ - public function setLinks($links) + public function setNumErrors($num_errors) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); } - $this->container['links'] = $links; + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at requested_at + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; return $this; } @@ -499,6 +540,33 @@ public function setResults($results) return $this; } + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at started_at + * + * @return self + */ + 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; + } + /** * Gets status * @@ -538,11 +606,11 @@ public function setStatus($status) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -550,12 +618,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -580,11 +648,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php b/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php deleted file mode 100644 index a55e826e..00000000 --- a/codegen/Crm/Properties/Model/BatchResponsePropertyWithErrors.php +++ /dev/null @@ -1,697 +0,0 @@ - - */ -class BatchResponsePropertyWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'BatchResponsePropertyWithErrors'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'completed_at' => '\DateTime', - 'num_errors' => 'int', - 'requested_at' => '\DateTime', - 'started_at' => '\DateTime', - 'links' => 'array', - 'results' => '\HubSpot\Client\Crm\Properties\Model\Property[]', - 'errors' => '\HubSpot\Client\Crm\Properties\Model\StandardError[]', - 'status' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'completed_at' => 'date-time', - 'num_errors' => 'int32', - 'requested_at' => 'date-time', - 'started_at' => 'date-time', - 'links' => null, - 'results' => null, - 'errors' => null, - '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 - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - 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 - * - * @var string[] - */ - protected static $attributeMap = [ - 'completed_at' => 'completedAt', - 'num_errors' => 'numErrors', - 'requested_at' => 'requestedAt', - 'started_at' => 'startedAt', - 'links' => 'links', - 'results' => 'results', - 'errors' => 'errors', - 'status' => 'status' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'completed_at' => 'setCompletedAt', - 'num_errors' => 'setNumErrors', - 'requested_at' => 'setRequestedAt', - 'started_at' => 'setStartedAt', - 'links' => 'setLinks', - 'results' => 'setResults', - 'errors' => 'setErrors', - 'status' => 'setStatus' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'completed_at' => 'getCompletedAt', - 'num_errors' => 'getNumErrors', - 'requested_at' => 'getRequestedAt', - 'started_at' => 'getStartedAt', - 'links' => 'getLinks', - 'results' => 'getResults', - 'errors' => 'getErrors', - 'status' => 'getStatus' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; - public const STATUS_CANCELED = 'CANCELED'; - public const STATUS_COMPLETE = 'COMPLETE'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_PENDING, - self::STATUS_PROCESSING, - self::STATUS_CANCELED, - self::STATUS_COMPLETE, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[]|null $data Associated array of property values - * initializing the model - */ - public function __construct(?array $data = 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; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['completed_at'] === null) { - $invalidProperties[] = "'completed_at' can't be null"; - } - if ($this->container['started_at'] === null) { - $invalidProperties[] = "'started_at' can't be null"; - } - if ($this->container['results'] === null) { - $invalidProperties[] = "'results' can't be null"; - } - if ($this->container['status'] === null) { - $invalidProperties[] = "'status' can't be null"; - } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets completed_at - * - * @return \DateTime - */ - public function getCompletedAt() - { - return $this->container['completed_at']; - } - - /** - * Sets completed_at - * - * @param \DateTime $completed_at completed_at - * - * @return self - */ - public function setCompletedAt($completed_at) - { - if (is_null($completed_at)) { - throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); - } - $this->container['completed_at'] = $completed_at; - - return $this; - } - - /** - * Gets num_errors - * - * @return int|null - */ - public function getNumErrors() - { - return $this->container['num_errors']; - } - - /** - * Sets num_errors - * - * @param int|null $num_errors num_errors - * - * @return self - */ - 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; - } - - /** - * Gets requested_at - * - * @return \DateTime|null - */ - public function getRequestedAt() - { - return $this->container['requested_at']; - } - - /** - * Sets requested_at - * - * @param \DateTime|null $requested_at requested_at - * - * @return self - */ - public function setRequestedAt($requested_at) - { - if (is_null($requested_at)) { - throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); - } - $this->container['requested_at'] = $requested_at; - - return $this; - } - - /** - * Gets started_at - * - * @return \DateTime - */ - public function getStartedAt() - { - return $this->container['started_at']; - } - - /** - * Sets started_at - * - * @param \DateTime $started_at started_at - * - * @return self - */ - 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; - } - - /** - * Gets links - * - * @return array|null - */ - public function getLinks() - { - return $this->container['links']; - } - - /** - * Sets links - * - * @param array|null $links links - * - * @return self - */ - public function setLinks($links) - { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); - } - $this->container['links'] = $links; - - return $this; - } - - /** - * Gets results - * - * @return \HubSpot\Client\Crm\Properties\Model\Property[] - */ - public function getResults() - { - return $this->container['results']; - } - - /** - * Sets results - * - * @param \HubSpot\Client\Crm\Properties\Model\Property[] $results results - * - * @return self - */ - public function setResults($results) - { - if (is_null($results)) { - throw new \InvalidArgumentException('non-nullable results cannot be null'); - } - $this->container['results'] = $results; - - return $this; - } - - /** - * Gets errors - * - * @return \HubSpot\Client\Crm\Properties\Model\StandardError[]|null - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \HubSpot\Client\Crm\Properties\Model\StandardError[]|null $errors errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - - /** - * Gets status - * - * @return string - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string $status status - * - * @return self - */ - 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( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } - $this->container['status'] = $status; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php b/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php index 99d26bb3..b27104f4 100644 --- a/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php +++ b/codegen/Crm/Properties/Model/CollectionResponsePropertyGroupNoPaging.php @@ -2,7 +2,7 @@ /** * CollectionResponsePropertyGroupNoPaging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -321,11 +321,11 @@ public function setResults($results) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php b/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php index 7eb3f06b..a1156c5f 100644 --- a/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php +++ b/codegen/Crm/Properties/Model/CollectionResponsePropertyNoPaging.php @@ -2,7 +2,7 @@ /** * CollectionResponsePropertyNoPaging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -321,11 +321,11 @@ public function setResults($results) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/Error.php b/codegen/Crm/Properties/Model/Error.php index 44594743..248c50a1 100644 --- a/codegen/Crm/Properties/Model/Error.php +++ b/codegen/Crm/Properties/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,13 +57,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\Crm\Properties\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Crm\Properties\Model\ErrorDetail[]' + 'sub_category' => 'string' ]; /** @@ -74,13 +74,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, 'correlation_id' => 'uuid', + 'errors' => null, 'links' => null, 'message' => null, - 'category' => null, - 'errors' => null + 'sub_category' => null ]; /** @@ -89,13 +89,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, 'correlation_id' => false, + 'errors' => false, 'links' => false, 'message' => false, - 'category' => false, - 'errors' => false + 'sub_category' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', 'correlation_id' => 'correlationId', + 'errors' => 'errors', 'links' => 'links', 'message' => 'message', - 'category' => 'category', - 'errors' => 'errors' + 'sub_category' => 'subCategory' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', 'correlation_id' => 'setCorrelationId', + 'errors' => 'setErrors', 'links' => 'setLinks', 'message' => 'setMessage', - 'category' => 'setCategory', - 'errors' => 'setErrors' + 'sub_category' => 'setSubCategory' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', 'correlation_id' => 'getCorrelationId', + 'errors' => 'getErrors', 'links' => 'getLinks', 'message' => 'getMessage', - 'category' => 'getCategory', - 'errors' => 'getErrors' + 'sub_category' => 'getSubCategory' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -316,15 +316,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['correlation_id'] === null) { $invalidProperties[] = "'correlation_id' can't be null"; } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } return $invalidProperties; } @@ -341,28 +341,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return string|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string $category The error category * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -421,6 +421,33 @@ public function setCorrelationId($correlation_id) return $this; } + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Properties\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Properties\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** * Gets links * @@ -476,66 +503,39 @@ public function setMessage($message) } /** - * Gets category - * - * @return string - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string $category The error category - * - * @return self - */ - public function setCategory($category) - { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); - } - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets errors + * Gets sub_category * - * @return \HubSpot\Client\Crm\Properties\Model\ErrorDetail[]|null + * @return string|null */ - public function getErrors() + public function getSubCategory() { - return $this->container['errors']; + return $this->container['sub_category']; } /** - * Sets errors + * Sets sub_category * - * @param \HubSpot\Client\Crm\Properties\Model\ErrorDetail[]|null $errors further information about the error + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setErrors($errors) + public function setSubCategory($sub_category) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['errors'] = $errors; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -543,12 +543,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -573,11 +573,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/ErrorDetail.php b/codegen/Crm/Properties/Model/ErrorDetail.php index 6ae7f066..60d56422 100644 --- a/codegen/Crm/Properties/Model/ErrorDetail.php +++ b/codegen/Crm/Properties/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,11 +57,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', 'code' => 'string', - 'in' => 'string', 'context' => 'array', - 'message' => 'string' + 'in' => 'string', + 'message' => 'string', + 'sub_category' => 'string' ]; /** @@ -72,11 +72,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, 'code' => null, - 'in' => null, 'context' => null, - 'message' => null + 'in' => null, + 'message' => null, + 'sub_category' => null ]; /** @@ -85,11 +85,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, 'code' => false, - 'in' => false, 'context' => false, - 'message' => false + 'in' => false, + 'message' => false, + 'sub_category' => false ]; /** @@ -178,11 +178,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', 'code' => 'code', - 'in' => 'in', 'context' => 'context', - 'message' => 'message' + 'in' => 'in', + 'message' => 'message', + 'sub_category' => 'subCategory' ]; /** @@ -191,11 +191,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', 'code' => 'setCode', - 'in' => 'setIn', 'context' => 'setContext', - 'message' => 'setMessage' + 'in' => 'setIn', + 'message' => 'setMessage', + 'sub_category' => 'setSubCategory' ]; /** @@ -204,11 +204,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', 'code' => 'getCode', - 'in' => 'getIn', 'context' => 'getContext', - 'message' => 'getMessage' + 'in' => 'getIn', + 'message' => 'getMessage', + 'sub_category' => 'getSubCategory' ]; /** @@ -268,11 +268,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -321,55 +321,55 @@ public function valid() /** - * Gets sub_category + * Gets code * * @return string|null */ - public function getSubCategory() + public function getCode() { - return $this->container['sub_category']; + return $this->container['code']; } /** - * Sets sub_category + * Sets code * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $code The status code associated with the error detail * * @return self */ - public function setSubCategory($sub_category) + public function setCode($code) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['code'] = $code; return $this; } /** - * Gets code + * Gets context * - * @return string|null + * @return array|null */ - public function getCode() + public function getContext() { - return $this->container['code']; + return $this->container['context']; } /** - * Sets code + * Sets context * - * @param string|null $code The status code associated with the error detail + * @param array|null $context Context about the error condition * * @return self */ - public function setCode($code) + public function setContext($context) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); } - $this->container['code'] = $code; + $this->container['context'] = $context; return $this; } @@ -402,66 +402,66 @@ public function setIn($in) } /** - * Gets context + * Gets message * - * @return array|null + * @return string */ - public function getContext() + public function getMessage() { - return $this->container['context']; + return $this->container['message']; } /** - * Sets context + * Sets message * - * @param array|null $context Context about the error condition + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setContext($context) + public function setMessage($message) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['context'] = $context; + $this->container['message'] = $message; return $this; } /** - * Gets message + * Gets sub_category * - * @return string + * @return string|null */ - public function getMessage() + public function getSubCategory() { - return $this->container['message']; + return $this->container['sub_category']; } /** - * Sets message + * Sets sub_category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setMessage($message) + public function setSubCategory($sub_category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['message'] = $message; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -469,12 +469,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -499,11 +499,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/ModelInterface.php b/codegen/Crm/Properties/Model/ModelInterface.php index 08ffd98d..c064a45a 100644 --- a/codegen/Crm/Properties/Model/ModelInterface.php +++ b/codegen/Crm/Properties/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties\Model @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** diff --git a/codegen/Crm/Properties/Model/Option.php b/codegen/Crm/Properties/Model/Option.php index aa2b71d0..a2a651e1 100644 --- a/codegen/Crm/Properties/Model/Option.php +++ b/codegen/Crm/Properties/Model/Option.php @@ -2,7 +2,7 @@ /** * Option * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * Option Class Doc Comment * * @category Class + * @description A HubSpot property option * @package HubSpot\Client\Crm\Properties * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,9 +58,9 @@ class Option implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'hidden' => 'bool', - 'display_order' => 'int', 'description' => 'string', + 'display_order' => 'int', + 'hidden' => 'bool', 'label' => 'string', 'value' => 'string' ]; @@ -72,9 +73,9 @@ class Option implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'hidden' => null, - 'display_order' => 'int32', 'description' => null, + 'display_order' => 'int32', + 'hidden' => null, 'label' => null, 'value' => null ]; @@ -85,9 +86,9 @@ class Option implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'hidden' => false, - 'display_order' => false, 'description' => false, + 'display_order' => false, + 'hidden' => false, 'label' => false, 'value' => false ]; @@ -178,9 +179,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'hidden' => 'hidden', - 'display_order' => 'displayOrder', 'description' => 'description', + 'display_order' => 'displayOrder', + 'hidden' => 'hidden', 'label' => 'label', 'value' => 'value' ]; @@ -191,9 +192,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'hidden' => 'setHidden', - 'display_order' => 'setDisplayOrder', 'description' => 'setDescription', + 'display_order' => 'setDisplayOrder', + 'hidden' => 'setHidden', 'label' => 'setLabel', 'value' => 'setValue' ]; @@ -204,9 +205,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'hidden' => 'getHidden', - 'display_order' => 'getDisplayOrder', 'description' => 'getDescription', + 'display_order' => 'getDisplayOrder', + 'hidden' => 'getHidden', 'label' => 'getLabel', 'value' => 'getValue' ]; @@ -268,9 +269,9 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); } @@ -327,28 +328,28 @@ public function valid() /** - * Gets hidden + * Gets description * - * @return bool + * @return string|null */ - public function getHidden() + public function getDescription() { - return $this->container['hidden']; + return $this->container['description']; } /** - * Sets hidden + * Sets description * - * @param bool $hidden Hidden options will not be displayed in HubSpot. + * @param string|null $description A description of the property that will be shown as help text in HubSpot. * * @return self */ - public function setHidden($hidden) + public function setDescription($description) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['description'] = $description; return $this; } @@ -366,7 +367,7 @@ public function getDisplayOrder() /** * Sets display_order * - * @param int|null $display_order Options are displayed in order starting with the lowest positive integer value. Values of -1 will cause the option to be displayed after any positive values. + * @param int|null $display_order Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. * * @return self */ @@ -381,28 +382,28 @@ public function setDisplayOrder($display_order) } /** - * Gets description + * Gets hidden * - * @return string|null + * @return bool */ - public function getDescription() + public function getHidden() { - return $this->container['description']; + return $this->container['hidden']; } /** - * Sets description + * Sets hidden * - * @param string|null $description A description of the option. + * @param bool $hidden If true, the property won't be visible and can't be used in HubSpot. * * @return self */ - public function setDescription($description) + public function setHidden($hidden) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['description'] = $description; + $this->container['hidden'] = $hidden; return $this; } @@ -420,7 +421,7 @@ public function getLabel() /** * Sets label * - * @param string $label A human-readable option label that will be shown in HubSpot. + * @param string $label A human-readable label that will be shown in HubSpot. * * @return self */ @@ -463,11 +464,11 @@ public function setValue($value) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -475,12 +476,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -505,11 +506,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/OptionInput.php b/codegen/Crm/Properties/Model/OptionInput.php index f4aef774..3ed39c58 100644 --- a/codegen/Crm/Properties/Model/OptionInput.php +++ b/codegen/Crm/Properties/Model/OptionInput.php @@ -2,7 +2,7 @@ /** * OptionInput * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,9 +57,9 @@ class OptionInput implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'hidden' => 'bool', - 'display_order' => 'int', 'description' => 'string', + 'display_order' => 'int', + 'hidden' => 'bool', 'label' => 'string', 'value' => 'string' ]; @@ -72,9 +72,9 @@ class OptionInput implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'hidden' => null, - 'display_order' => 'int32', 'description' => null, + 'display_order' => 'int32', + 'hidden' => null, 'label' => null, 'value' => null ]; @@ -85,9 +85,9 @@ class OptionInput implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'hidden' => false, - 'display_order' => false, 'description' => false, + 'display_order' => false, + 'hidden' => false, 'label' => false, 'value' => false ]; @@ -178,9 +178,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'hidden' => 'hidden', - 'display_order' => 'displayOrder', 'description' => 'description', + 'display_order' => 'displayOrder', + 'hidden' => 'hidden', 'label' => 'label', 'value' => 'value' ]; @@ -191,9 +191,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'hidden' => 'setHidden', - 'display_order' => 'setDisplayOrder', 'description' => 'setDescription', + 'display_order' => 'setDisplayOrder', + 'hidden' => 'setHidden', 'label' => 'setLabel', 'value' => 'setValue' ]; @@ -204,9 +204,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'hidden' => 'getHidden', - 'display_order' => 'getDisplayOrder', 'description' => 'getDescription', + 'display_order' => 'getDisplayOrder', + 'hidden' => 'getHidden', 'label' => 'getLabel', 'value' => 'getValue' ]; @@ -268,9 +268,9 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); $this->setIfExists('value', $data ?? [], null); } @@ -327,28 +327,28 @@ public function valid() /** - * Gets hidden + * Gets description * - * @return bool + * @return string|null */ - public function getHidden() + public function getDescription() { - return $this->container['hidden']; + return $this->container['description']; } /** - * Sets hidden + * Sets description * - * @param bool $hidden Hidden options won't be shown in HubSpot. + * @param string|null $description A description of the property that will be shown as help text in HubSpot. * * @return self */ - public function setHidden($hidden) + public function setDescription($description) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['description'] = $description; return $this; } @@ -366,7 +366,7 @@ public function getDisplayOrder() /** * Sets display_order * - * @param int|null $display_order Options are shown in order starting with the lowest positive integer value. Values of -1 will cause the option to be displayed after any positive values. + * @param int|null $display_order Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. * * @return self */ @@ -381,28 +381,28 @@ public function setDisplayOrder($display_order) } /** - * Gets description + * Gets hidden * - * @return string|null + * @return bool */ - public function getDescription() + public function getHidden() { - return $this->container['description']; + return $this->container['hidden']; } /** - * Sets description + * Sets hidden * - * @param string|null $description A description of the option. + * @param bool $hidden If true, the property won't be visible and can't be used in HubSpot. * * @return self */ - public function setDescription($description) + public function setHidden($hidden) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['description'] = $description; + $this->container['hidden'] = $hidden; return $this; } @@ -420,7 +420,7 @@ public function getLabel() /** * Sets label * - * @param string $label A human-readable option label that will be shown in HubSpot. + * @param string $label A human-readable label that will be shown in HubSpot. * * @return self */ @@ -463,11 +463,11 @@ public function setValue($value) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -475,12 +475,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -505,11 +505,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/Property.php b/codegen/Crm/Properties/Model/Property.php index c3efe492..103f343f 100644 --- a/codegen/Crm/Properties/Model/Property.php +++ b/codegen/Crm/Properties/Model/Property.php @@ -2,7 +2,7 @@ /** * Property * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * Property Class Doc Comment * * @category Class + * @description A HubSpot property * @package HubSpot\Client\Crm\Properties * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,30 +58,33 @@ class Property implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'calculated' => 'bool', + 'calculation_formula' => 'string', + 'created_at' => '\DateTime', 'created_user_id' => 'string', - 'hidden' => 'bool', - 'modification_metadata' => '\HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata', - 'display_order' => 'int', + 'data_sensitivity' => 'string', + 'date_display_hint' => 'string', 'description' => 'string', - 'show_currency_symbol' => 'bool', - 'label' => 'string', - 'type' => 'string', - 'hubspot_defined' => 'bool', + 'display_order' => 'int', + 'external_options' => 'bool', + 'field_type' => 'string', 'form_field' => 'bool', - 'created_at' => '\DateTime', - 'archived_at' => '\DateTime', - 'archived' => 'bool', 'group_name' => 'string', - 'referenced_object_type' => 'string', + 'has_unique_value' => 'bool', + 'hidden' => 'bool', + 'hubspot_defined' => 'bool', + 'label' => 'string', + 'modification_metadata' => '\HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata', 'name' => 'string', 'options' => '\HubSpot\Client\Crm\Properties\Model\Option[]', - 'calculation_formula' => 'string', - 'has_unique_value' => 'bool', - 'field_type' => 'string', - 'updated_user_id' => 'string', - 'calculated' => 'bool', - 'external_options' => 'bool', - 'updated_at' => '\DateTime' + 'referenced_object_type' => 'string', + 'sensitive_data_categories' => 'string[]', + 'show_currency_symbol' => 'bool', + 'type' => 'string', + 'updated_at' => '\DateTime', + 'updated_user_id' => 'string' ]; /** @@ -91,30 +95,33 @@ class Property implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'archived' => null, + 'archived_at' => 'date-time', + 'calculated' => null, + 'calculation_formula' => null, + 'created_at' => 'date-time', 'created_user_id' => null, - 'hidden' => null, - 'modification_metadata' => null, - 'display_order' => 'int32', + 'data_sensitivity' => null, + 'date_display_hint' => null, 'description' => null, - 'show_currency_symbol' => null, - 'label' => null, - 'type' => null, - 'hubspot_defined' => null, + 'display_order' => 'int32', + 'external_options' => null, + 'field_type' => null, 'form_field' => null, - 'created_at' => 'date-time', - 'archived_at' => 'date-time', - 'archived' => null, 'group_name' => null, - 'referenced_object_type' => null, + 'has_unique_value' => null, + 'hidden' => null, + 'hubspot_defined' => null, + 'label' => null, + 'modification_metadata' => null, 'name' => null, 'options' => null, - 'calculation_formula' => null, - 'has_unique_value' => null, - 'field_type' => null, - 'updated_user_id' => null, - 'calculated' => null, - 'external_options' => null, - 'updated_at' => 'date-time' + 'referenced_object_type' => null, + 'sensitive_data_categories' => null, + 'show_currency_symbol' => null, + 'type' => null, + 'updated_at' => 'date-time', + 'updated_user_id' => null ]; /** @@ -123,30 +130,33 @@ class Property implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'archived' => false, + 'archived_at' => false, + 'calculated' => false, + 'calculation_formula' => false, + 'created_at' => false, 'created_user_id' => false, - 'hidden' => false, - 'modification_metadata' => false, - 'display_order' => false, + 'data_sensitivity' => false, + 'date_display_hint' => false, 'description' => false, - 'show_currency_symbol' => false, - 'label' => false, - 'type' => false, - 'hubspot_defined' => false, + 'display_order' => false, + 'external_options' => false, + 'field_type' => false, 'form_field' => false, - 'created_at' => false, - 'archived_at' => false, - 'archived' => false, 'group_name' => false, - 'referenced_object_type' => false, + 'has_unique_value' => false, + 'hidden' => false, + 'hubspot_defined' => false, + 'label' => false, + 'modification_metadata' => false, 'name' => false, 'options' => false, - 'calculation_formula' => false, - 'has_unique_value' => false, - 'field_type' => false, - 'updated_user_id' => false, - 'calculated' => false, - 'external_options' => false, - 'updated_at' => false + 'referenced_object_type' => false, + 'sensitive_data_categories' => false, + 'show_currency_symbol' => false, + 'type' => false, + 'updated_at' => false, + 'updated_user_id' => false ]; /** @@ -235,30 +245,33 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'calculated' => 'calculated', + 'calculation_formula' => 'calculationFormula', + 'created_at' => 'createdAt', 'created_user_id' => 'createdUserId', - 'hidden' => 'hidden', - 'modification_metadata' => 'modificationMetadata', - 'display_order' => 'displayOrder', + 'data_sensitivity' => 'dataSensitivity', + 'date_display_hint' => 'dateDisplayHint', 'description' => 'description', - 'show_currency_symbol' => 'showCurrencySymbol', - 'label' => 'label', - 'type' => 'type', - 'hubspot_defined' => 'hubspotDefined', + 'display_order' => 'displayOrder', + 'external_options' => 'externalOptions', + 'field_type' => 'fieldType', 'form_field' => 'formField', - 'created_at' => 'createdAt', - 'archived_at' => 'archivedAt', - 'archived' => 'archived', 'group_name' => 'groupName', - 'referenced_object_type' => 'referencedObjectType', + 'has_unique_value' => 'hasUniqueValue', + 'hidden' => 'hidden', + 'hubspot_defined' => 'hubspotDefined', + 'label' => 'label', + 'modification_metadata' => 'modificationMetadata', 'name' => 'name', 'options' => 'options', - 'calculation_formula' => 'calculationFormula', - 'has_unique_value' => 'hasUniqueValue', - 'field_type' => 'fieldType', - 'updated_user_id' => 'updatedUserId', - 'calculated' => 'calculated', - 'external_options' => 'externalOptions', - 'updated_at' => 'updatedAt' + 'referenced_object_type' => 'referencedObjectType', + 'sensitive_data_categories' => 'sensitiveDataCategories', + 'show_currency_symbol' => 'showCurrencySymbol', + 'type' => 'type', + 'updated_at' => 'updatedAt', + 'updated_user_id' => 'updatedUserId' ]; /** @@ -267,30 +280,33 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'calculated' => 'setCalculated', + 'calculation_formula' => 'setCalculationFormula', + 'created_at' => 'setCreatedAt', 'created_user_id' => 'setCreatedUserId', - 'hidden' => 'setHidden', - 'modification_metadata' => 'setModificationMetadata', - 'display_order' => 'setDisplayOrder', + 'data_sensitivity' => 'setDataSensitivity', + 'date_display_hint' => 'setDateDisplayHint', 'description' => 'setDescription', - 'show_currency_symbol' => 'setShowCurrencySymbol', - 'label' => 'setLabel', - 'type' => 'setType', - 'hubspot_defined' => 'setHubspotDefined', + 'display_order' => 'setDisplayOrder', + 'external_options' => 'setExternalOptions', + 'field_type' => 'setFieldType', 'form_field' => 'setFormField', - 'created_at' => 'setCreatedAt', - 'archived_at' => 'setArchivedAt', - 'archived' => 'setArchived', 'group_name' => 'setGroupName', - 'referenced_object_type' => 'setReferencedObjectType', + 'has_unique_value' => 'setHasUniqueValue', + 'hidden' => 'setHidden', + 'hubspot_defined' => 'setHubspotDefined', + 'label' => 'setLabel', + 'modification_metadata' => 'setModificationMetadata', 'name' => 'setName', 'options' => 'setOptions', - 'calculation_formula' => 'setCalculationFormula', - 'has_unique_value' => 'setHasUniqueValue', - 'field_type' => 'setFieldType', - 'updated_user_id' => 'setUpdatedUserId', - 'calculated' => 'setCalculated', - 'external_options' => 'setExternalOptions', - 'updated_at' => 'setUpdatedAt' + 'referenced_object_type' => 'setReferencedObjectType', + 'sensitive_data_categories' => 'setSensitiveDataCategories', + 'show_currency_symbol' => 'setShowCurrencySymbol', + 'type' => 'setType', + 'updated_at' => 'setUpdatedAt', + 'updated_user_id' => 'setUpdatedUserId' ]; /** @@ -299,30 +315,33 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'calculated' => 'getCalculated', + 'calculation_formula' => 'getCalculationFormula', + 'created_at' => 'getCreatedAt', 'created_user_id' => 'getCreatedUserId', - 'hidden' => 'getHidden', - 'modification_metadata' => 'getModificationMetadata', - 'display_order' => 'getDisplayOrder', + 'data_sensitivity' => 'getDataSensitivity', + 'date_display_hint' => 'getDateDisplayHint', 'description' => 'getDescription', - 'show_currency_symbol' => 'getShowCurrencySymbol', - 'label' => 'getLabel', - 'type' => 'getType', - 'hubspot_defined' => 'getHubspotDefined', + 'display_order' => 'getDisplayOrder', + 'external_options' => 'getExternalOptions', + 'field_type' => 'getFieldType', 'form_field' => 'getFormField', - 'created_at' => 'getCreatedAt', - 'archived_at' => 'getArchivedAt', - 'archived' => 'getArchived', 'group_name' => 'getGroupName', - 'referenced_object_type' => 'getReferencedObjectType', + 'has_unique_value' => 'getHasUniqueValue', + 'hidden' => 'getHidden', + 'hubspot_defined' => 'getHubspotDefined', + 'label' => 'getLabel', + 'modification_metadata' => 'getModificationMetadata', 'name' => 'getName', 'options' => 'getOptions', - 'calculation_formula' => 'getCalculationFormula', - 'has_unique_value' => 'getHasUniqueValue', - 'field_type' => 'getFieldType', - 'updated_user_id' => 'getUpdatedUserId', - 'calculated' => 'getCalculated', - 'external_options' => 'getExternalOptions', - 'updated_at' => 'getUpdatedAt' + 'referenced_object_type' => 'getReferencedObjectType', + 'sensitive_data_categories' => 'getSensitiveDataCategories', + 'show_currency_symbol' => 'getShowCurrencySymbol', + 'type' => 'getType', + 'updated_at' => 'getUpdatedAt', + 'updated_user_id' => 'getUpdatedUserId' ]; /** @@ -366,6 +385,42 @@ public function getModelName() return self::$openAPIModelName; } + public const DATA_SENSITIVITY_HIGHLY_SENSITIVE = 'highly_sensitive'; + public const DATA_SENSITIVITY_NON_SENSITIVE = 'non_sensitive'; + public const DATA_SENSITIVITY_SENSITIVE = 'sensitive'; + public const DATE_DISPLAY_HINT_ABSOLUTE = 'absolute'; + public const DATE_DISPLAY_HINT_ABSOLUTE_WITH_RELATIVE = 'absolute_with_relative'; + public const DATE_DISPLAY_HINT_TIME_SINCE = 'time_since'; + public const DATE_DISPLAY_HINT_TIME_UNTIL = 'time_until'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDataSensitivityAllowableValues() + { + return [ + self::DATA_SENSITIVITY_HIGHLY_SENSITIVE, + self::DATA_SENSITIVITY_NON_SENSITIVE, + self::DATA_SENSITIVITY_SENSITIVE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getDateDisplayHintAllowableValues() + { + return [ + self::DATE_DISPLAY_HINT_ABSOLUTE, + self::DATE_DISPLAY_HINT_ABSOLUTE_WITH_RELATIVE, + self::DATE_DISPLAY_HINT_TIME_SINCE, + self::DATE_DISPLAY_HINT_TIME_UNTIL, + ]; + } /** * Associative array for storing property values @@ -382,30 +437,33 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('calculated', $data ?? [], null); + $this->setIfExists('calculation_formula', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('created_user_id', $data ?? [], null); - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('modification_metadata', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('data_sensitivity', $data ?? [], null); + $this->setIfExists('date_display_hint', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('show_currency_symbol', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('hubspot_defined', $data ?? [], null); + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('external_options', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], null); $this->setIfExists('form_field', $data ?? [], null); - $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('archived_at', $data ?? [], null); - $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('group_name', $data ?? [], null); - $this->setIfExists('referenced_object_type', $data ?? [], null); + $this->setIfExists('has_unique_value', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('hubspot_defined', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('modification_metadata', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('options', $data ?? [], null); - $this->setIfExists('calculation_formula', $data ?? [], null); - $this->setIfExists('has_unique_value', $data ?? [], null); - $this->setIfExists('field_type', $data ?? [], null); - $this->setIfExists('updated_user_id', $data ?? [], null); - $this->setIfExists('calculated', $data ?? [], null); - $this->setIfExists('external_options', $data ?? [], null); + $this->setIfExists('referenced_object_type', $data ?? [], null); + $this->setIfExists('sensitive_data_categories', $data ?? [], null); + $this->setIfExists('show_currency_symbol', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('updated_user_id', $data ?? [], null); } /** @@ -435,26 +493,44 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!is_null($this->container['data_sensitivity']) && !in_array($this->container['data_sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $this->container['data_sensitivity'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getDateDisplayHintAllowableValues(); + if (!is_null($this->container['date_display_hint']) && !in_array($this->container['date_display_hint'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'date_display_hint', must be one of '%s'", + $this->container['date_display_hint'], + implode("', '", $allowedValues) + ); + } + if ($this->container['description'] === null) { $invalidProperties[] = "'description' can't be null"; } - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; - } - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; + if ($this->container['field_type'] === null) { + $invalidProperties[] = "'field_type' can't be null"; } if ($this->container['group_name'] === null) { $invalidProperties[] = "'group_name' can't be null"; } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } if ($this->container['options'] === null) { $invalidProperties[] = "'options' can't be null"; } - if ($this->container['field_type'] === null) { - $invalidProperties[] = "'field_type' can't be null"; + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; } return $invalidProperties; } @@ -472,352 +548,372 @@ public function valid() /** - * Gets created_user_id + * Gets archived * - * @return string|null + * @return bool|null */ - public function getCreatedUserId() + public function getArchived() { - return $this->container['created_user_id']; + return $this->container['archived']; } /** - * Sets created_user_id + * Sets archived * - * @param string|null $created_user_id The internal user ID of the user who created the property in HubSpot. This field may not exist if the property was created outside of HubSpot. + * @param bool|null $archived Whether or not the property is archived. * * @return self */ - public function setCreatedUserId($created_user_id) + public function setArchived($archived) { - if (is_null($created_user_id)) { - throw new \InvalidArgumentException('non-nullable created_user_id cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['created_user_id'] = $created_user_id; + $this->container['archived'] = $archived; return $this; } /** - * Gets hidden + * Gets archived_at * - * @return bool|null + * @return \DateTime|null */ - public function getHidden() + public function getArchivedAt() { - return $this->container['hidden']; + return $this->container['archived_at']; } /** - * Sets hidden + * Sets archived_at * - * @param bool|null $hidden Whether or not the property will be hidden from the HubSpot UI. It's recommended this be set to false for custom properties. + * @param \DateTime|null $archived_at When the property was archived. * * @return self */ - public function setHidden($hidden) + public function setArchivedAt($archived_at) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['archived_at'] = $archived_at; return $this; } /** - * Gets modification_metadata + * Gets calculated * - * @return \HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata|null + * @return bool|null */ - public function getModificationMetadata() + public function getCalculated() { - return $this->container['modification_metadata']; + return $this->container['calculated']; } /** - * Sets modification_metadata + * Sets calculated * - * @param \HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata|null $modification_metadata modification_metadata + * @param bool|null $calculated For default properties, true indicates that the property is calculated by a HubSpot process. It has no effect for custom properties. * * @return self */ - public function setModificationMetadata($modification_metadata) + public function setCalculated($calculated) { - if (is_null($modification_metadata)) { - throw new \InvalidArgumentException('non-nullable modification_metadata cannot be null'); + if (is_null($calculated)) { + throw new \InvalidArgumentException('non-nullable calculated cannot be null'); } - $this->container['modification_metadata'] = $modification_metadata; + $this->container['calculated'] = $calculated; return $this; } /** - * Gets display_order + * Gets calculation_formula * - * @return int|null + * @return string|null */ - public function getDisplayOrder() + public function getCalculationFormula() { - return $this->container['display_order']; + return $this->container['calculation_formula']; } /** - * Sets display_order + * Sets calculation_formula * - * @param int|null $display_order Properties are shown in order, starting with the lowest positive integer value. + * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. * * @return self */ - public function setDisplayOrder($display_order) + public function setCalculationFormula($calculation_formula) { - if (is_null($display_order)) { - throw new \InvalidArgumentException('non-nullable display_order cannot be null'); + if (is_null($calculation_formula)) { + throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); } - $this->container['display_order'] = $display_order; + $this->container['calculation_formula'] = $calculation_formula; return $this; } /** - * Gets description + * Gets created_at * - * @return string + * @return \DateTime|null */ - public function getDescription() + public function getCreatedAt() { - return $this->container['description']; + return $this->container['created_at']; } /** - * Sets description + * Sets created_at * - * @param string $description A description of the property that will be shown as help text in HubSpot. + * @param \DateTime|null $created_at The timestamp when the property was created, in ISO 8601 format. * * @return self */ - public function setDescription($description) + public function setCreatedAt($created_at) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['description'] = $description; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets show_currency_symbol + * Gets created_user_id * - * @return bool|null + * @return string|null */ - public function getShowCurrencySymbol() + public function getCreatedUserId() { - return $this->container['show_currency_symbol']; + return $this->container['created_user_id']; } /** - * Sets show_currency_symbol + * Sets created_user_id * - * @param bool|null $show_currency_symbol Whether or not the property will display the currency symbol set in the account settings. + * @param string|null $created_user_id The internal user ID of the user who created the property in HubSpot. This field may not exist if the property was created outside of HubSpot. * * @return self */ - public function setShowCurrencySymbol($show_currency_symbol) + public function setCreatedUserId($created_user_id) { - if (is_null($show_currency_symbol)) { - throw new \InvalidArgumentException('non-nullable show_currency_symbol cannot be null'); + if (is_null($created_user_id)) { + throw new \InvalidArgumentException('non-nullable created_user_id cannot be null'); } - $this->container['show_currency_symbol'] = $show_currency_symbol; + $this->container['created_user_id'] = $created_user_id; return $this; } /** - * Gets label + * Gets data_sensitivity * - * @return string + * @return string|null */ - public function getLabel() + public function getDataSensitivity() { - return $this->container['label']; + return $this->container['data_sensitivity']; } /** - * Sets label + * Sets data_sensitivity * - * @param string $label A human-readable property label that will be shown in HubSpot. + * @param string|null $data_sensitivity Indicates the sensitivity level of the property, such as \"non_sensitive\", \"sensitive\", or \"highly_sensitive\". * * @return self */ - public function setLabel($label) + public function setDataSensitivity($data_sensitivity) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($data_sensitivity)) { + throw new \InvalidArgumentException('non-nullable data_sensitivity cannot be null'); } - $this->container['label'] = $label; + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!in_array($data_sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $data_sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_sensitivity'] = $data_sensitivity; return $this; } /** - * Gets type + * Gets date_display_hint * - * @return string + * @return string|null */ - public function getType() + public function getDateDisplayHint() { - return $this->container['type']; + return $this->container['date_display_hint']; } /** - * Sets type + * Sets date_display_hint * - * @param string $type The property data type. + * @param string|null $date_display_hint date_display_hint * * @return self */ - public function setType($type) + public function setDateDisplayHint($date_display_hint) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); + if (is_null($date_display_hint)) { + throw new \InvalidArgumentException('non-nullable date_display_hint cannot be null'); } - $this->container['type'] = $type; + $allowedValues = $this->getDateDisplayHintAllowableValues(); + if (!in_array($date_display_hint, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'date_display_hint', must be one of '%s'", + $date_display_hint, + implode("', '", $allowedValues) + ) + ); + } + $this->container['date_display_hint'] = $date_display_hint; return $this; } /** - * Gets hubspot_defined + * Gets description * - * @return bool|null + * @return string */ - public function getHubspotDefined() + public function getDescription() { - return $this->container['hubspot_defined']; + return $this->container['description']; } /** - * Sets hubspot_defined + * Sets description * - * @param bool|null $hubspot_defined This will be true for default object properties built into HubSpot. + * @param string $description A description of the property that will be shown as help text in HubSpot. * * @return self */ - public function setHubspotDefined($hubspot_defined) + public function setDescription($description) { - if (is_null($hubspot_defined)) { - throw new \InvalidArgumentException('non-nullable hubspot_defined cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hubspot_defined'] = $hubspot_defined; + $this->container['description'] = $description; return $this; } /** - * Gets form_field + * Gets display_order * - * @return bool|null + * @return int|null */ - public function getFormField() + public function getDisplayOrder() { - return $this->container['form_field']; + return $this->container['display_order']; } /** - * Sets form_field + * Sets display_order * - * @param bool|null $form_field Whether or not the property can be used in a HubSpot form. + * @param int|null $display_order Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. * * @return self */ - public function setFormField($form_field) + public function setDisplayOrder($display_order) { - if (is_null($form_field)) { - throw new \InvalidArgumentException('non-nullable form_field cannot be null'); + if (is_null($display_order)) { + throw new \InvalidArgumentException('non-nullable display_order cannot be null'); } - $this->container['form_field'] = $form_field; + $this->container['display_order'] = $display_order; return $this; } /** - * Gets created_at + * Gets external_options * - * @return \DateTime|null + * @return bool|null */ - public function getCreatedAt() + public function getExternalOptions() { - return $this->container['created_at']; + return $this->container['external_options']; } /** - * Sets created_at + * Sets external_options * - * @param \DateTime|null $created_at + * @param bool|null $external_options Applicable only for 'enumeration' type properties. Should be set to true in conjunction with a 'referencedObjectType' of 'OWNER'. Otherwise false. * * @return self */ - public function setCreatedAt($created_at) + public function setExternalOptions($external_options) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($external_options)) { + throw new \InvalidArgumentException('non-nullable external_options cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['external_options'] = $external_options; return $this; } /** - * Gets archived_at + * Gets field_type * - * @return \DateTime|null + * @return string */ - public function getArchivedAt() + public function getFieldType() { - return $this->container['archived_at']; + return $this->container['field_type']; } /** - * Sets archived_at + * Sets field_type * - * @param \DateTime|null $archived_at When the property was archived. + * @param string $field_type Controls how the property appears in HubSpot. * * @return self */ - public function setArchivedAt($archived_at) + public function setFieldType($field_type) { - if (is_null($archived_at)) { - throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['archived_at'] = $archived_at; + $this->container['field_type'] = $field_type; return $this; } /** - * Gets archived + * Gets form_field * * @return bool|null */ - public function getArchived() + public function getFormField() { - return $this->container['archived']; + return $this->container['form_field']; } /** - * Sets archived + * Sets form_field * - * @param bool|null $archived Whether or not the property is archived. + * @param bool|null $form_field Whether or not the property can be used in a HubSpot form. * * @return self */ - public function setArchived($archived) + public function setFormField($form_field) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($form_field)) { + throw new \InvalidArgumentException('non-nullable form_field cannot be null'); } - $this->container['archived'] = $archived; + $this->container['form_field'] = $form_field; return $this; } @@ -850,244 +946,298 @@ public function setGroupName($group_name) } /** - * Gets referenced_object_type + * Gets has_unique_value * - * @return string|null + * @return bool|null */ - public function getReferencedObjectType() + public function getHasUniqueValue() { - return $this->container['referenced_object_type']; + return $this->container['has_unique_value']; } /** - * Sets referenced_object_type + * Sets has_unique_value * - * @param string|null $referenced_object_type If this property is related to other object(s), they'll be listed here. + * @param bool|null $has_unique_value Whether or not the property's value must be unique. Once set, this can't be changed. * * @return self */ - public function setReferencedObjectType($referenced_object_type) + public function setHasUniqueValue($has_unique_value) { - if (is_null($referenced_object_type)) { - throw new \InvalidArgumentException('non-nullable referenced_object_type cannot be null'); + if (is_null($has_unique_value)) { + throw new \InvalidArgumentException('non-nullable has_unique_value cannot be null'); } - $this->container['referenced_object_type'] = $referenced_object_type; + $this->container['has_unique_value'] = $has_unique_value; return $this; } /** - * Gets name + * Gets hidden * - * @return string + * @return bool|null */ - public function getName() + public function getHidden() { - return $this->container['name']; + return $this->container['hidden']; } /** - * Sets name + * Sets hidden * - * @param string $name The internal property name, which must be used when referencing the property via the API. + * @param bool|null $hidden If true, the property won't be visible and can't be used in HubSpot. * * @return self */ - public function setName($name) + public function setHidden($hidden) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['name'] = $name; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets options + * Gets hubspot_defined * - * @return \HubSpot\Client\Crm\Properties\Model\Option[] + * @return bool|null */ - public function getOptions() + public function getHubspotDefined() { - return $this->container['options']; + return $this->container['hubspot_defined']; } /** - * Sets options + * Sets hubspot_defined * - * @param \HubSpot\Client\Crm\Properties\Model\Option[] $options A list of valid options for the property. This field is required for enumerated properties, but will be empty for other property types. + * @param bool|null $hubspot_defined This will be true for default object properties built into HubSpot. * * @return self */ - public function setOptions($options) + public function setHubspotDefined($hubspot_defined) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($hubspot_defined)) { + throw new \InvalidArgumentException('non-nullable hubspot_defined cannot be null'); } - $this->container['options'] = $options; + $this->container['hubspot_defined'] = $hubspot_defined; return $this; } /** - * Gets calculation_formula + * Gets label * - * @return string|null + * @return string */ - public function getCalculationFormula() + public function getLabel() { - return $this->container['calculation_formula']; + return $this->container['label']; } /** - * Sets calculation_formula + * Sets label * - * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. + * @param string $label A human-readable label that will be shown in HubSpot. * * @return self */ - public function setCalculationFormula($calculation_formula) + public function setLabel($label) { - if (is_null($calculation_formula)) { - throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['calculation_formula'] = $calculation_formula; + $this->container['label'] = $label; return $this; } /** - * Gets has_unique_value + * Gets modification_metadata * - * @return bool|null + * @return \HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata|null */ - public function getHasUniqueValue() + public function getModificationMetadata() { - return $this->container['has_unique_value']; + return $this->container['modification_metadata']; } /** - * Sets has_unique_value + * Sets modification_metadata * - * @param bool|null $has_unique_value Whether or not the property's value must be unique. Once set, this can't be changed. + * @param \HubSpot\Client\Crm\Properties\Model\PropertyModificationMetadata|null $modification_metadata modification_metadata * * @return self */ - public function setHasUniqueValue($has_unique_value) + public function setModificationMetadata($modification_metadata) { - if (is_null($has_unique_value)) { - throw new \InvalidArgumentException('non-nullable has_unique_value cannot be null'); + if (is_null($modification_metadata)) { + throw new \InvalidArgumentException('non-nullable modification_metadata cannot be null'); } - $this->container['has_unique_value'] = $has_unique_value; + $this->container['modification_metadata'] = $modification_metadata; return $this; } /** - * Gets field_type + * Gets name * * @return string */ - public function getFieldType() + public function getName() { - return $this->container['field_type']; + return $this->container['name']; } /** - * Sets field_type + * Sets name * - * @param string $field_type Controls how the property appears in HubSpot. + * @param string $name The name of the property to read or modify. * * @return self */ - public function setFieldType($field_type) + public function setName($name) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['name'] = $name; return $this; } /** - * Gets updated_user_id + * Gets options + * + * @return \HubSpot\Client\Crm\Properties\Model\Option[] + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \HubSpot\Client\Crm\Properties\Model\Option[] $options A list of valid options for the property. This field is required for enumerated properties. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets referenced_object_type * * @return string|null */ - public function getUpdatedUserId() + public function getReferencedObjectType() { - return $this->container['updated_user_id']; + return $this->container['referenced_object_type']; } /** - * Sets updated_user_id + * Sets referenced_object_type * - * @param string|null $updated_user_id The internal user ID of the user who updated the property in HubSpot. This field may not exist if the property was updated outside of HubSpot. + * @param string|null $referenced_object_type Should be set to 'OWNER' when 'externalOptions' is true, which causes the property to dynamically pull option values from the current HubSpot users. * * @return self */ - public function setUpdatedUserId($updated_user_id) + public function setReferencedObjectType($referenced_object_type) { - if (is_null($updated_user_id)) { - throw new \InvalidArgumentException('non-nullable updated_user_id cannot be null'); + if (is_null($referenced_object_type)) { + throw new \InvalidArgumentException('non-nullable referenced_object_type cannot be null'); } - $this->container['updated_user_id'] = $updated_user_id; + $this->container['referenced_object_type'] = $referenced_object_type; return $this; } /** - * Gets calculated + * Gets sensitive_data_categories * - * @return bool|null + * @return string[]|null */ - public function getCalculated() + public function getSensitiveDataCategories() { - return $this->container['calculated']; + return $this->container['sensitive_data_categories']; } /** - * Sets calculated + * Sets sensitive_data_categories * - * @param bool|null $calculated For default properties, true indicates that the property is calculated by a HubSpot process. It has no effect for custom properties. + * @param string[]|null $sensitive_data_categories When sensitiveData is true, lists the type of sensitive data contained in the property (e.g., \"HIPAA\"). * * @return self */ - public function setCalculated($calculated) + public function setSensitiveDataCategories($sensitive_data_categories) { - if (is_null($calculated)) { - throw new \InvalidArgumentException('non-nullable calculated cannot be null'); + if (is_null($sensitive_data_categories)) { + throw new \InvalidArgumentException('non-nullable sensitive_data_categories cannot be null'); } - $this->container['calculated'] = $calculated; + $this->container['sensitive_data_categories'] = $sensitive_data_categories; return $this; } /** - * Gets external_options + * Gets show_currency_symbol * * @return bool|null */ - public function getExternalOptions() + public function getShowCurrencySymbol() { - return $this->container['external_options']; + return $this->container['show_currency_symbol']; } /** - * Sets external_options + * Sets show_currency_symbol * - * @param bool|null $external_options For default properties, true indicates that the options are stored externally to the property settings. + * @param bool|null $show_currency_symbol Whether or not the property will display the currency symbol set in the account settings. * * @return self */ - public function setExternalOptions($external_options) + public function setShowCurrencySymbol($show_currency_symbol) { - if (is_null($external_options)) { - throw new \InvalidArgumentException('non-nullable external_options cannot be null'); + if (is_null($show_currency_symbol)) { + throw new \InvalidArgumentException('non-nullable show_currency_symbol cannot be null'); } - $this->container['external_options'] = $external_options; + $this->container['show_currency_symbol'] = $show_currency_symbol; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The data type of the property. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; return $this; } @@ -1105,7 +1255,7 @@ public function getUpdatedAt() /** * Sets updated_at * - * @param \DateTime|null $updated_at + * @param \DateTime|null $updated_at The timestamp when the property was last updated, in ISO 8601 format. * * @return self */ @@ -1118,14 +1268,41 @@ public function setUpdatedAt($updated_at) return $this; } + + /** + * Gets updated_user_id + * + * @return string|null + */ + public function getUpdatedUserId() + { + return $this->container['updated_user_id']; + } + + /** + * Sets updated_user_id + * + * @param string|null $updated_user_id The internal user ID of the user who updated the property in HubSpot. This field may not exist if the property was updated outside of HubSpot. + * + * @return self + */ + public function setUpdatedUserId($updated_user_id) + { + if (is_null($updated_user_id)) { + throw new \InvalidArgumentException('non-nullable updated_user_id cannot be null'); + } + $this->container['updated_user_id'] = $updated_user_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -1133,12 +1310,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -1163,11 +1340,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyCreate.php b/codegen/Crm/Properties/Model/PropertyCreate.php index aa76d119..741953cc 100644 --- a/codegen/Crm/Properties/Model/PropertyCreate.php +++ b/codegen/Crm/Properties/Model/PropertyCreate.php @@ -2,7 +2,7 @@ /** * PropertyCreate * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,20 +57,21 @@ class PropertyCreate implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'hidden' => 'bool', - 'display_order' => 'int', + 'calculation_formula' => 'string', + 'data_sensitivity' => 'string', 'description' => 'string', - 'label' => 'string', - 'type' => 'string', + 'display_order' => 'int', + 'external_options' => 'bool', + 'field_type' => 'string', 'form_field' => 'bool', 'group_name' => 'string', - 'referenced_object_type' => 'string', + 'has_unique_value' => 'bool', + 'hidden' => 'bool', + 'label' => 'string', 'name' => 'string', 'options' => '\HubSpot\Client\Crm\Properties\Model\OptionInput[]', - 'calculation_formula' => 'string', - 'has_unique_value' => 'bool', - 'field_type' => 'string', - 'external_options' => 'bool' + 'referenced_object_type' => 'string', + 'type' => 'string' ]; /** @@ -81,20 +82,21 @@ class PropertyCreate implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'hidden' => null, - 'display_order' => 'int32', + 'calculation_formula' => null, + 'data_sensitivity' => null, 'description' => null, - 'label' => null, - 'type' => null, + 'display_order' => 'int32', + 'external_options' => null, + 'field_type' => null, 'form_field' => null, 'group_name' => null, - 'referenced_object_type' => null, + 'has_unique_value' => null, + 'hidden' => null, + 'label' => null, 'name' => null, 'options' => null, - 'calculation_formula' => null, - 'has_unique_value' => null, - 'field_type' => null, - 'external_options' => null + 'referenced_object_type' => null, + 'type' => null ]; /** @@ -103,20 +105,21 @@ class PropertyCreate implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'hidden' => false, - 'display_order' => false, + 'calculation_formula' => false, + 'data_sensitivity' => false, 'description' => false, - 'label' => false, - 'type' => false, + 'display_order' => false, + 'external_options' => false, + 'field_type' => false, 'form_field' => false, 'group_name' => false, - 'referenced_object_type' => false, + 'has_unique_value' => false, + 'hidden' => false, + 'label' => false, 'name' => false, 'options' => false, - 'calculation_formula' => false, - 'has_unique_value' => false, - 'field_type' => false, - 'external_options' => false + 'referenced_object_type' => false, + 'type' => false ]; /** @@ -205,20 +208,21 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'hidden' => 'hidden', - 'display_order' => 'displayOrder', + 'calculation_formula' => 'calculationFormula', + 'data_sensitivity' => 'dataSensitivity', 'description' => 'description', - 'label' => 'label', - 'type' => 'type', + 'display_order' => 'displayOrder', + 'external_options' => 'externalOptions', + 'field_type' => 'fieldType', 'form_field' => 'formField', 'group_name' => 'groupName', - 'referenced_object_type' => 'referencedObjectType', + 'has_unique_value' => 'hasUniqueValue', + 'hidden' => 'hidden', + 'label' => 'label', 'name' => 'name', 'options' => 'options', - 'calculation_formula' => 'calculationFormula', - 'has_unique_value' => 'hasUniqueValue', - 'field_type' => 'fieldType', - 'external_options' => 'externalOptions' + 'referenced_object_type' => 'referencedObjectType', + 'type' => 'type' ]; /** @@ -227,20 +231,21 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'hidden' => 'setHidden', - 'display_order' => 'setDisplayOrder', + 'calculation_formula' => 'setCalculationFormula', + 'data_sensitivity' => 'setDataSensitivity', 'description' => 'setDescription', - 'label' => 'setLabel', - 'type' => 'setType', + 'display_order' => 'setDisplayOrder', + 'external_options' => 'setExternalOptions', + 'field_type' => 'setFieldType', 'form_field' => 'setFormField', 'group_name' => 'setGroupName', - 'referenced_object_type' => 'setReferencedObjectType', + 'has_unique_value' => 'setHasUniqueValue', + 'hidden' => 'setHidden', + 'label' => 'setLabel', 'name' => 'setName', 'options' => 'setOptions', - 'calculation_formula' => 'setCalculationFormula', - 'has_unique_value' => 'setHasUniqueValue', - 'field_type' => 'setFieldType', - 'external_options' => 'setExternalOptions' + 'referenced_object_type' => 'setReferencedObjectType', + 'type' => 'setType' ]; /** @@ -249,20 +254,21 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'hidden' => 'getHidden', - 'display_order' => 'getDisplayOrder', + 'calculation_formula' => 'getCalculationFormula', + 'data_sensitivity' => 'getDataSensitivity', 'description' => 'getDescription', - 'label' => 'getLabel', - 'type' => 'getType', + 'display_order' => 'getDisplayOrder', + 'external_options' => 'getExternalOptions', + 'field_type' => 'getFieldType', 'form_field' => 'getFormField', 'group_name' => 'getGroupName', - 'referenced_object_type' => 'getReferencedObjectType', + 'has_unique_value' => 'getHasUniqueValue', + 'hidden' => 'getHidden', + 'label' => 'getLabel', 'name' => 'getName', 'options' => 'getOptions', - 'calculation_formula' => 'getCalculationFormula', - 'has_unique_value' => 'getHasUniqueValue', - 'field_type' => 'getFieldType', - 'external_options' => 'getExternalOptions' + 'referenced_object_type' => 'getReferencedObjectType', + 'type' => 'getType' ]; /** @@ -306,37 +312,40 @@ public function getModelName() return self::$openAPIModelName; } - public const TYPE_STRING = 'string'; - public const TYPE_NUMBER = 'number'; - public const TYPE_DATE = 'date'; - public const TYPE_DATETIME = 'datetime'; - public const TYPE_ENUMERATION = 'enumeration'; - public const TYPE_BOOL = 'bool'; - public const FIELD_TYPE_TEXTAREA = 'textarea'; - public const FIELD_TYPE_TEXT = 'text'; + public const DATA_SENSITIVITY_HIGHLY_SENSITIVE = 'highly_sensitive'; + public const DATA_SENSITIVITY_NON_SENSITIVE = 'non_sensitive'; + public const DATA_SENSITIVITY_SENSITIVE = 'sensitive'; + public const FIELD_TYPE_BOOLEANCHECKBOX = 'booleancheckbox'; + public const FIELD_TYPE_CALCULATION_EQUATION = 'calculation_equation'; + public const FIELD_TYPE_CHECKBOX = 'checkbox'; public const FIELD_TYPE_DATE = 'date'; public const FIELD_TYPE_FILE = 'file'; + public const FIELD_TYPE_HTML = 'html'; public const FIELD_TYPE_NUMBER = 'number'; - public const FIELD_TYPE_SELECT = 'select'; + public const FIELD_TYPE_PHONENUMBER = 'phonenumber'; public const FIELD_TYPE_RADIO = 'radio'; - public const FIELD_TYPE_CHECKBOX = 'checkbox'; - public const FIELD_TYPE_BOOLEANCHECKBOX = 'booleancheckbox'; - public const FIELD_TYPE_CALCULATION_EQUATION = 'calculation_equation'; + public const FIELD_TYPE_SELECT = 'select'; + public const FIELD_TYPE_TEXT = 'text'; + public const FIELD_TYPE_TEXTAREA = 'textarea'; + public const TYPE_BOOL = 'bool'; + public const TYPE_DATE = 'date'; + public const TYPE_DATETIME = 'datetime'; + public const TYPE_ENUMERATION = 'enumeration'; + public const TYPE_NUMBER = 'number'; + public const TYPE_PHONE_NUMBER = 'phone_number'; + public const TYPE_STRING = 'string'; /** * Gets allowable values of the enum * * @return string[] */ - public function getTypeAllowableValues() + public function getDataSensitivityAllowableValues() { return [ - self::TYPE_STRING, - self::TYPE_NUMBER, - self::TYPE_DATE, - self::TYPE_DATETIME, - self::TYPE_ENUMERATION, - self::TYPE_BOOL, + self::DATA_SENSITIVITY_HIGHLY_SENSITIVE, + self::DATA_SENSITIVITY_NON_SENSITIVE, + self::DATA_SENSITIVITY_SENSITIVE, ]; } @@ -348,16 +357,36 @@ public function getTypeAllowableValues() public function getFieldTypeAllowableValues() { return [ - self::FIELD_TYPE_TEXTAREA, - self::FIELD_TYPE_TEXT, + self::FIELD_TYPE_BOOLEANCHECKBOX, + self::FIELD_TYPE_CALCULATION_EQUATION, + self::FIELD_TYPE_CHECKBOX, self::FIELD_TYPE_DATE, self::FIELD_TYPE_FILE, + self::FIELD_TYPE_HTML, self::FIELD_TYPE_NUMBER, - self::FIELD_TYPE_SELECT, + self::FIELD_TYPE_PHONENUMBER, self::FIELD_TYPE_RADIO, - self::FIELD_TYPE_CHECKBOX, - self::FIELD_TYPE_BOOLEANCHECKBOX, - self::FIELD_TYPE_CALCULATION_EQUATION, + self::FIELD_TYPE_SELECT, + self::FIELD_TYPE_TEXT, + self::FIELD_TYPE_TEXTAREA, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BOOL, + self::TYPE_DATE, + self::TYPE_DATETIME, + self::TYPE_ENUMERATION, + self::TYPE_NUMBER, + self::TYPE_PHONE_NUMBER, + self::TYPE_STRING, ]; } @@ -376,20 +405,21 @@ public function getFieldTypeAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('calculation_formula', $data ?? [], null); + $this->setIfExists('data_sensitivity', $data ?? [], null); $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('label', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('external_options', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], null); $this->setIfExists('form_field', $data ?? [], null); $this->setIfExists('group_name', $data ?? [], null); - $this->setIfExists('referenced_object_type', $data ?? [], null); + $this->setIfExists('has_unique_value', $data ?? [], null); + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); $this->setIfExists('options', $data ?? [], null); - $this->setIfExists('calculation_formula', $data ?? [], null); - $this->setIfExists('has_unique_value', $data ?? [], null); - $this->setIfExists('field_type', $data ?? [], null); - $this->setIfExists('external_options', $data ?? [], null); + $this->setIfExists('referenced_object_type', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); } /** @@ -419,17 +449,23 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['label'] === null) { - $invalidProperties[] = "'label' can't be null"; + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!is_null($this->container['data_sensitivity']) && !in_array($this->container['data_sensitivity'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $this->container['data_sensitivity'], + implode("', '", $allowedValues) + ); } - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; + + if ($this->container['field_type'] === null) { + $invalidProperties[] = "'field_type' can't be null"; } - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value '%s' for 'type', must be one of '%s'", - $this->container['type'], + "invalid value '%s' for 'field_type', must be one of '%s'", + $this->container['field_type'], implode("', '", $allowedValues) ); } @@ -437,17 +473,20 @@ public function listInvalidProperties() if ($this->container['group_name'] === null) { $invalidProperties[] = "'group_name' can't be null"; } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' can't be null"; + } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - if ($this->container['field_type'] === null) { - $invalidProperties[] = "'field_type' can't be null"; + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value '%s' for 'field_type', must be one of '%s'", - $this->container['field_type'], + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -468,55 +507,65 @@ public function valid() /** - * Gets hidden + * Gets calculation_formula * - * @return bool|null + * @return string|null */ - public function getHidden() + public function getCalculationFormula() { - return $this->container['hidden']; + return $this->container['calculation_formula']; } /** - * Sets hidden + * Sets calculation_formula * - * @param bool|null $hidden If true, the property won't be visible and can't be used in HubSpot. + * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. * * @return self */ - public function setHidden($hidden) + public function setCalculationFormula($calculation_formula) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($calculation_formula)) { + throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['calculation_formula'] = $calculation_formula; return $this; } /** - * Gets display_order + * Gets data_sensitivity * - * @return int|null + * @return string|null */ - public function getDisplayOrder() + public function getDataSensitivity() { - return $this->container['display_order']; + return $this->container['data_sensitivity']; } /** - * Sets display_order + * Sets data_sensitivity * - * @param int|null $display_order Properties are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property to be displayed after any positive values. + * @param string|null $data_sensitivity data_sensitivity * * @return self */ - public function setDisplayOrder($display_order) + public function setDataSensitivity($data_sensitivity) { - if (is_null($display_order)) { - throw new \InvalidArgumentException('non-nullable display_order cannot be null'); + if (is_null($data_sensitivity)) { + throw new \InvalidArgumentException('non-nullable data_sensitivity cannot be null'); } - $this->container['display_order'] = $display_order; + $allowedValues = $this->getDataSensitivityAllowableValues(); + if (!in_array($data_sensitivity, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'data_sensitivity', must be one of '%s'", + $data_sensitivity, + implode("', '", $allowedValues) + ) + ); + } + $this->container['data_sensitivity'] = $data_sensitivity; return $this; } @@ -549,65 +598,92 @@ public function setDescription($description) } /** - * Gets label + * Gets display_order * - * @return string + * @return int|null */ - public function getLabel() + public function getDisplayOrder() { - return $this->container['label']; + return $this->container['display_order']; } /** - * Sets label + * Sets display_order * - * @param string $label A human-readable property label that will be shown in HubSpot. + * @param int|null $display_order Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. * * @return self */ - public function setLabel($label) + public function setDisplayOrder($display_order) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($display_order)) { + throw new \InvalidArgumentException('non-nullable display_order cannot be null'); } - $this->container['label'] = $label; + $this->container['display_order'] = $display_order; return $this; } /** - * Gets type + * Gets external_options + * + * @return bool|null + */ + public function getExternalOptions() + { + return $this->container['external_options']; + } + + /** + * Sets external_options + * + * @param bool|null $external_options Applicable only for 'enumeration' type properties. Should be set to true in conjunction with a 'referencedObjectType' of 'OWNER'. Otherwise false. + * + * @return self + */ + public function setExternalOptions($external_options) + { + if (is_null($external_options)) { + throw new \InvalidArgumentException('non-nullable external_options cannot be null'); + } + $this->container['external_options'] = $external_options; + + return $this; + } + + /** + * Gets field_type * * @return string */ - public function getType() + public function getFieldType() { - return $this->container['type']; + return $this->container['field_type']; } /** - * Sets type + * Sets field_type * - * @param string $type The data type of the property. + * @param string $field_type Controls how the property appears in HubSpot. * * @return self */ - public function setType($type) + public function setFieldType($field_type) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( - "Invalid value '%s' for 'type', must be one of '%s'", - $type, + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, implode("', '", $allowedValues) ) ); } - $this->container['type'] = $type; + $this->container['field_type'] = $field_type; return $this; } @@ -667,211 +743,211 @@ public function setGroupName($group_name) } /** - * Gets referenced_object_type + * Gets has_unique_value * - * @return string|null + * @return bool|null */ - public function getReferencedObjectType() + public function getHasUniqueValue() { - return $this->container['referenced_object_type']; + return $this->container['has_unique_value']; } /** - * Sets referenced_object_type + * Sets has_unique_value * - * @param string|null $referenced_object_type Should be set to 'OWNER' when 'externalOptions' is true, which causes the property to dynamically pull option values from the current HubSpot users. + * @param bool|null $has_unique_value Whether or not the property's value must be unique. Once set, this can't be changed. * * @return self */ - public function setReferencedObjectType($referenced_object_type) + public function setHasUniqueValue($has_unique_value) { - if (is_null($referenced_object_type)) { - throw new \InvalidArgumentException('non-nullable referenced_object_type cannot be null'); + if (is_null($has_unique_value)) { + throw new \InvalidArgumentException('non-nullable has_unique_value cannot be null'); } - $this->container['referenced_object_type'] = $referenced_object_type; + $this->container['has_unique_value'] = $has_unique_value; return $this; } /** - * Gets name + * Gets hidden * - * @return string + * @return bool|null */ - public function getName() + public function getHidden() { - return $this->container['name']; + return $this->container['hidden']; } /** - * Sets name + * Sets hidden * - * @param string $name The internal property name, which must be used when referencing the property via the API. + * @param bool|null $hidden If true, the property won't be visible and can't be used in HubSpot. * * @return self */ - public function setName($name) + public function setHidden($hidden) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['name'] = $name; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets options + * Gets label * - * @return \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null + * @return string */ - public function getOptions() + public function getLabel() { - return $this->container['options']; + return $this->container['label']; } /** - * Sets options + * Sets label * - * @param \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null $options A list of valid options for the property. This field is required for enumerated properties. + * @param string $label A human-readable label that will be shown in HubSpot. * * @return self */ - public function setOptions($options) + public function setLabel($label) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['options'] = $options; + $this->container['label'] = $label; return $this; } /** - * Gets calculation_formula + * Gets name * - * @return string|null + * @return string */ - public function getCalculationFormula() + public function getName() { - return $this->container['calculation_formula']; + return $this->container['name']; } /** - * Sets calculation_formula + * Sets name * - * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. + * @param string $name The name of the property to read or modify. * * @return self */ - public function setCalculationFormula($calculation_formula) + public function setName($name) { - if (is_null($calculation_formula)) { - throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['calculation_formula'] = $calculation_formula; + $this->container['name'] = $name; return $this; } /** - * Gets has_unique_value + * Gets options * - * @return bool|null + * @return \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null */ - public function getHasUniqueValue() + public function getOptions() { - return $this->container['has_unique_value']; + return $this->container['options']; } /** - * Sets has_unique_value + * Sets options * - * @param bool|null $has_unique_value Whether or not the property's value must be unique. Once set, this can't be changed. + * @param \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null $options A list of valid options for the property. This field is required for enumerated properties. * * @return self */ - public function setHasUniqueValue($has_unique_value) + public function setOptions($options) { - if (is_null($has_unique_value)) { - throw new \InvalidArgumentException('non-nullable has_unique_value cannot be null'); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['has_unique_value'] = $has_unique_value; + $this->container['options'] = $options; return $this; } /** - * Gets field_type + * Gets referenced_object_type * - * @return string + * @return string|null */ - public function getFieldType() + public function getReferencedObjectType() { - return $this->container['field_type']; + return $this->container['referenced_object_type']; } /** - * Sets field_type + * Sets referenced_object_type * - * @param string $field_type Controls how the property appears in HubSpot. + * @param string|null $referenced_object_type Should be set to 'OWNER' when 'externalOptions' is true, which causes the property to dynamically pull option values from the current HubSpot users. * * @return self */ - public function setFieldType($field_type) + public function setReferencedObjectType($referenced_object_type) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($referenced_object_type)) { + throw new \InvalidArgumentException('non-nullable referenced_object_type cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['referenced_object_type'] = $referenced_object_type; return $this; } /** - * Gets external_options + * Gets type * - * @return bool|null + * @return string */ - public function getExternalOptions() + public function getType() { - return $this->container['external_options']; + return $this->container['type']; } /** - * Sets external_options + * Sets type * - * @param bool|null $external_options Applicable only for 'enumeration' type properties. Should be set to true in conjunction with a 'referencedObjectType' of 'OWNER'. Otherwise false. + * @param string $type The data type of the property. * * @return self */ - public function setExternalOptions($external_options) + public function setType($type) { - if (is_null($external_options)) { - throw new \InvalidArgumentException('non-nullable external_options cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['external_options'] = $external_options; + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -879,12 +955,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -909,11 +985,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyGroup.php b/codegen/Crm/Properties/Model/PropertyGroup.php index ed1b5c03..c008d54e 100644 --- a/codegen/Crm/Properties/Model/PropertyGroup.php +++ b/codegen/Crm/Properties/Model/PropertyGroup.php @@ -2,7 +2,7 @@ /** * PropertyGroup * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -59,9 +59,9 @@ class PropertyGroup implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'archived' => 'bool', - 'name' => 'string', 'display_order' => 'int', - 'label' => 'string' + 'label' => 'string', + 'name' => 'string' ]; /** @@ -73,9 +73,9 @@ class PropertyGroup implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'archived' => null, - 'name' => null, 'display_order' => 'int32', - 'label' => null + 'label' => null, + 'name' => null ]; /** @@ -85,9 +85,9 @@ class PropertyGroup implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'archived' => false, - 'name' => false, 'display_order' => false, - 'label' => false + 'label' => false, + 'name' => false ]; /** @@ -177,9 +177,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'archived' => 'archived', - 'name' => 'name', 'display_order' => 'displayOrder', - 'label' => 'label' + 'label' => 'label', + 'name' => 'name' ]; /** @@ -189,9 +189,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'archived' => 'setArchived', - 'name' => 'setName', 'display_order' => 'setDisplayOrder', - 'label' => 'setLabel' + 'label' => 'setLabel', + 'name' => 'setName' ]; /** @@ -201,9 +201,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'archived' => 'getArchived', - 'name' => 'getName', 'display_order' => 'getDisplayOrder', - 'label' => 'getLabel' + 'label' => 'getLabel', + 'name' => 'getName' ]; /** @@ -264,9 +264,9 @@ public function getModelName() public function __construct(?array $data = null) { $this->setIfExists('archived', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } /** @@ -299,15 +299,15 @@ public function listInvalidProperties() if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } if ($this->container['display_order'] === null) { $invalidProperties[] = "'display_order' can't be null"; } if ($this->container['label'] === null) { $invalidProperties[] = "'label' can't be null"; } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } return $invalidProperties; } @@ -350,33 +350,6 @@ public function setArchived($archived) return $this; } - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The internal property group name, which must be used when referencing the property group via the API. - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - /** * Gets display_order * @@ -430,14 +403,41 @@ public function setLabel($label) return $this; } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the property to read or modify. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -445,12 +445,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -475,11 +475,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyGroupCreate.php b/codegen/Crm/Properties/Model/PropertyGroupCreate.php index fc2f7d57..e8ac493f 100644 --- a/codegen/Crm/Properties/Model/PropertyGroupCreate.php +++ b/codegen/Crm/Properties/Model/PropertyGroupCreate.php @@ -2,7 +2,7 @@ /** * PropertyGroupCreate * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,9 +57,9 @@ class PropertyGroupCreate implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'name' => 'string', 'display_order' => 'int', - 'label' => 'string' + 'label' => 'string', + 'name' => 'string' ]; /** @@ -70,9 +70,9 @@ class PropertyGroupCreate implements ModelInterface, ArrayAccess, \JsonSerializa * @psalm-var array */ protected static $openAPIFormats = [ - 'name' => null, 'display_order' => 'int32', - 'label' => null + 'label' => null, + 'name' => null ]; /** @@ -81,9 +81,9 @@ class PropertyGroupCreate implements ModelInterface, ArrayAccess, \JsonSerializa * @var boolean[] */ protected static array $openAPINullables = [ - 'name' => false, 'display_order' => false, - 'label' => false + 'label' => false, + 'name' => false ]; /** @@ -172,9 +172,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'name' => 'name', 'display_order' => 'displayOrder', - 'label' => 'label' + 'label' => 'label', + 'name' => 'name' ]; /** @@ -183,9 +183,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'name' => 'setName', 'display_order' => 'setDisplayOrder', - 'label' => 'setLabel' + 'label' => 'setLabel', + 'name' => 'setName' ]; /** @@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'name' => 'getName', 'display_order' => 'getDisplayOrder', - 'label' => 'getLabel' + 'label' => 'getLabel', + 'name' => 'getName' ]; /** @@ -256,9 +256,9 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('display_order', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } /** @@ -288,12 +288,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } if ($this->container['label'] === null) { $invalidProperties[] = "'label' can't be null"; } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } return $invalidProperties; } @@ -309,33 +309,6 @@ public function valid() } - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The internal property group name, which must be used when referencing the property group via the API. - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - /** * Gets display_order * @@ -389,14 +362,41 @@ public function setLabel($label) return $this; } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the property to read or modify. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -404,12 +404,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -434,11 +434,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyGroupUpdate.php b/codegen/Crm/Properties/Model/PropertyGroupUpdate.php index d53187aa..18b00202 100644 --- a/codegen/Crm/Properties/Model/PropertyGroupUpdate.php +++ b/codegen/Crm/Properties/Model/PropertyGroupUpdate.php @@ -2,7 +2,7 @@ /** * PropertyGroupUpdate * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -352,11 +352,11 @@ public function setLabel($label) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -364,12 +364,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -394,11 +394,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyModificationMetadata.php b/codegen/Crm/Properties/Model/PropertyModificationMetadata.php index 0a907da8..5be5018a 100644 --- a/codegen/Crm/Properties/Model/PropertyModificationMetadata.php +++ b/codegen/Crm/Properties/Model/PropertyModificationMetadata.php @@ -2,7 +2,7 @@ /** * PropertyModificationMetadata * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,10 +57,10 @@ class PropertyModificationMetadata implements ModelInterface, ArrayAccess, \Json * @var string[] */ protected static $openAPITypes = [ - 'read_only_options' => 'bool', - 'read_only_value' => 'bool', + 'archivable' => 'bool', 'read_only_definition' => 'bool', - 'archivable' => 'bool' + 'read_only_options' => 'bool', + 'read_only_value' => 'bool' ]; /** @@ -71,10 +71,10 @@ class PropertyModificationMetadata implements ModelInterface, ArrayAccess, \Json * @psalm-var array */ protected static $openAPIFormats = [ - 'read_only_options' => null, - 'read_only_value' => null, + 'archivable' => null, 'read_only_definition' => null, - 'archivable' => null + 'read_only_options' => null, + 'read_only_value' => null ]; /** @@ -83,10 +83,10 @@ class PropertyModificationMetadata implements ModelInterface, ArrayAccess, \Json * @var boolean[] */ protected static array $openAPINullables = [ - 'read_only_options' => false, - 'read_only_value' => false, + 'archivable' => false, 'read_only_definition' => false, - 'archivable' => false + 'read_only_options' => false, + 'read_only_value' => false ]; /** @@ -175,10 +175,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'read_only_options' => 'readOnlyOptions', - 'read_only_value' => 'readOnlyValue', + 'archivable' => 'archivable', 'read_only_definition' => 'readOnlyDefinition', - 'archivable' => 'archivable' + 'read_only_options' => 'readOnlyOptions', + 'read_only_value' => 'readOnlyValue' ]; /** @@ -187,10 +187,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'read_only_options' => 'setReadOnlyOptions', - 'read_only_value' => 'setReadOnlyValue', + 'archivable' => 'setArchivable', 'read_only_definition' => 'setReadOnlyDefinition', - 'archivable' => 'setArchivable' + 'read_only_options' => 'setReadOnlyOptions', + 'read_only_value' => 'setReadOnlyValue' ]; /** @@ -199,10 +199,10 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'read_only_options' => 'getReadOnlyOptions', - 'read_only_value' => 'getReadOnlyValue', + 'archivable' => 'getArchivable', 'read_only_definition' => 'getReadOnlyDefinition', - 'archivable' => 'getArchivable' + 'read_only_options' => 'getReadOnlyOptions', + 'read_only_value' => 'getReadOnlyValue' ]; /** @@ -262,10 +262,10 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('archivable', $data ?? [], null); + $this->setIfExists('read_only_definition', $data ?? [], null); $this->setIfExists('read_only_options', $data ?? [], null); $this->setIfExists('read_only_value', $data ?? [], null); - $this->setIfExists('read_only_definition', $data ?? [], null); - $this->setIfExists('archivable', $data ?? [], null); } /** @@ -295,14 +295,14 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['read_only_value'] === null) { - $invalidProperties[] = "'read_only_value' can't be null"; + if ($this->container['archivable'] === null) { + $invalidProperties[] = "'archivable' can't be null"; } if ($this->container['read_only_definition'] === null) { $invalidProperties[] = "'read_only_definition' can't be null"; } - if ($this->container['archivable'] === null) { - $invalidProperties[] = "'archivable' can't be null"; + if ($this->container['read_only_value'] === null) { + $invalidProperties[] = "'read_only_value' can't be null"; } return $invalidProperties; } @@ -320,120 +320,120 @@ public function valid() /** - * Gets read_only_options + * Gets archivable * - * @return bool|null + * @return bool */ - public function getReadOnlyOptions() + public function getArchivable() { - return $this->container['read_only_options']; + return $this->container['archivable']; } /** - * Sets read_only_options + * Sets archivable * - * @param bool|null $read_only_options read_only_options + * @param bool $archivable archivable * * @return self */ - public function setReadOnlyOptions($read_only_options) + public function setArchivable($archivable) { - if (is_null($read_only_options)) { - throw new \InvalidArgumentException('non-nullable read_only_options cannot be null'); + if (is_null($archivable)) { + throw new \InvalidArgumentException('non-nullable archivable cannot be null'); } - $this->container['read_only_options'] = $read_only_options; + $this->container['archivable'] = $archivable; return $this; } /** - * Gets read_only_value + * Gets read_only_definition * * @return bool */ - public function getReadOnlyValue() + public function getReadOnlyDefinition() { - return $this->container['read_only_value']; + return $this->container['read_only_definition']; } /** - * Sets read_only_value + * Sets read_only_definition * - * @param bool $read_only_value read_only_value + * @param bool $read_only_definition read_only_definition * * @return self */ - public function setReadOnlyValue($read_only_value) + public function setReadOnlyDefinition($read_only_definition) { - if (is_null($read_only_value)) { - throw new \InvalidArgumentException('non-nullable read_only_value cannot be null'); + if (is_null($read_only_definition)) { + throw new \InvalidArgumentException('non-nullable read_only_definition cannot be null'); } - $this->container['read_only_value'] = $read_only_value; + $this->container['read_only_definition'] = $read_only_definition; return $this; } /** - * Gets read_only_definition + * Gets read_only_options * - * @return bool + * @return bool|null */ - public function getReadOnlyDefinition() + public function getReadOnlyOptions() { - return $this->container['read_only_definition']; + return $this->container['read_only_options']; } /** - * Sets read_only_definition + * Sets read_only_options * - * @param bool $read_only_definition read_only_definition + * @param bool|null $read_only_options read_only_options * * @return self */ - public function setReadOnlyDefinition($read_only_definition) + public function setReadOnlyOptions($read_only_options) { - if (is_null($read_only_definition)) { - throw new \InvalidArgumentException('non-nullable read_only_definition cannot be null'); + if (is_null($read_only_options)) { + throw new \InvalidArgumentException('non-nullable read_only_options cannot be null'); } - $this->container['read_only_definition'] = $read_only_definition; + $this->container['read_only_options'] = $read_only_options; return $this; } /** - * Gets archivable + * Gets read_only_value * * @return bool */ - public function getArchivable() + public function getReadOnlyValue() { - return $this->container['archivable']; + return $this->container['read_only_value']; } /** - * Sets archivable + * Sets read_only_value * - * @param bool $archivable archivable + * @param bool $read_only_value read_only_value * * @return self */ - public function setArchivable($archivable) + public function setReadOnlyValue($read_only_value) { - if (is_null($archivable)) { - throw new \InvalidArgumentException('non-nullable archivable cannot be null'); + if (is_null($read_only_value)) { + throw new \InvalidArgumentException('non-nullable read_only_value cannot be null'); } - $this->container['archivable'] = $archivable; + $this->container['read_only_value'] = $read_only_value; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -441,12 +441,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -471,11 +471,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyName.php b/codegen/Crm/Properties/Model/PropertyName.php index 8f13ddc5..e29ffcca 100644 --- a/codegen/Crm/Properties/Model/PropertyName.php +++ b/codegen/Crm/Properties/Model/PropertyName.php @@ -2,7 +2,7 @@ /** * PropertyName * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -321,11 +321,11 @@ public function setName($name) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -333,12 +333,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -363,11 +363,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/PropertyUpdate.php b/codegen/Crm/Properties/Model/PropertyUpdate.php index 9fa68a24..14735caf 100644 --- a/codegen/Crm/Properties/Model/PropertyUpdate.php +++ b/codegen/Crm/Properties/Model/PropertyUpdate.php @@ -2,7 +2,7 @@ /** * PropertyUpdate * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,16 +57,16 @@ class PropertyUpdate implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'calculation_formula' => 'string', + 'description' => 'string', + 'display_order' => 'int', + 'field_type' => 'string', + 'form_field' => 'bool', 'group_name' => 'string', 'hidden' => 'bool', - 'options' => '\HubSpot\Client\Crm\Properties\Model\OptionInput[]', - 'display_order' => 'int', - 'description' => 'string', - 'calculation_formula' => 'string', 'label' => 'string', - 'type' => 'string', - 'field_type' => 'string', - 'form_field' => 'bool' + 'options' => '\HubSpot\Client\Crm\Properties\Model\OptionInput[]', + 'type' => 'string' ]; /** @@ -77,16 +77,16 @@ class PropertyUpdate implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'calculation_formula' => null, + 'description' => null, + 'display_order' => 'int32', + 'field_type' => null, + 'form_field' => null, 'group_name' => null, 'hidden' => null, - 'options' => null, - 'display_order' => 'int32', - 'description' => null, - 'calculation_formula' => null, 'label' => null, - 'type' => null, - 'field_type' => null, - 'form_field' => null + 'options' => null, + 'type' => null ]; /** @@ -95,16 +95,16 @@ class PropertyUpdate implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'calculation_formula' => false, + 'description' => false, + 'display_order' => false, + 'field_type' => false, + 'form_field' => false, 'group_name' => false, 'hidden' => false, - 'options' => false, - 'display_order' => false, - 'description' => false, - 'calculation_formula' => false, 'label' => false, - 'type' => false, - 'field_type' => false, - 'form_field' => false + 'options' => false, + 'type' => false ]; /** @@ -193,16 +193,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'calculation_formula' => 'calculationFormula', + 'description' => 'description', + 'display_order' => 'displayOrder', + 'field_type' => 'fieldType', + 'form_field' => 'formField', 'group_name' => 'groupName', 'hidden' => 'hidden', - 'options' => 'options', - 'display_order' => 'displayOrder', - 'description' => 'description', - 'calculation_formula' => 'calculationFormula', 'label' => 'label', - 'type' => 'type', - 'field_type' => 'fieldType', - 'form_field' => 'formField' + 'options' => 'options', + 'type' => 'type' ]; /** @@ -211,16 +211,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'calculation_formula' => 'setCalculationFormula', + 'description' => 'setDescription', + 'display_order' => 'setDisplayOrder', + 'field_type' => 'setFieldType', + 'form_field' => 'setFormField', 'group_name' => 'setGroupName', 'hidden' => 'setHidden', - 'options' => 'setOptions', - 'display_order' => 'setDisplayOrder', - 'description' => 'setDescription', - 'calculation_formula' => 'setCalculationFormula', 'label' => 'setLabel', - 'type' => 'setType', - 'field_type' => 'setFieldType', - 'form_field' => 'setFormField' + 'options' => 'setOptions', + 'type' => 'setType' ]; /** @@ -229,16 +229,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'calculation_formula' => 'getCalculationFormula', + 'description' => 'getDescription', + 'display_order' => 'getDisplayOrder', + 'field_type' => 'getFieldType', + 'form_field' => 'getFormField', 'group_name' => 'getGroupName', 'hidden' => 'getHidden', - 'options' => 'getOptions', - 'display_order' => 'getDisplayOrder', - 'description' => 'getDescription', - 'calculation_formula' => 'getCalculationFormula', 'label' => 'getLabel', - 'type' => 'getType', - 'field_type' => 'getFieldType', - 'form_field' => 'getFormField' + 'options' => 'getOptions', + 'type' => 'getType' ]; /** @@ -282,37 +282,46 @@ public function getModelName() return self::$openAPIModelName; } - public const TYPE_STRING = 'string'; - public const TYPE_NUMBER = 'number'; - public const TYPE_DATE = 'date'; - public const TYPE_DATETIME = 'datetime'; - public const TYPE_ENUMERATION = 'enumeration'; - public const TYPE_BOOL = 'bool'; - public const FIELD_TYPE_TEXTAREA = 'textarea'; - public const FIELD_TYPE_TEXT = 'text'; + public const FIELD_TYPE_BOOLEANCHECKBOX = 'booleancheckbox'; + public const FIELD_TYPE_CALCULATION_EQUATION = 'calculation_equation'; + public const FIELD_TYPE_CHECKBOX = 'checkbox'; public const FIELD_TYPE_DATE = 'date'; public const FIELD_TYPE_FILE = 'file'; + public const FIELD_TYPE_HTML = 'html'; public const FIELD_TYPE_NUMBER = 'number'; - public const FIELD_TYPE_SELECT = 'select'; + public const FIELD_TYPE_PHONENUMBER = 'phonenumber'; public const FIELD_TYPE_RADIO = 'radio'; - public const FIELD_TYPE_CHECKBOX = 'checkbox'; - public const FIELD_TYPE_BOOLEANCHECKBOX = 'booleancheckbox'; - public const FIELD_TYPE_CALCULATION_EQUATION = 'calculation_equation'; + public const FIELD_TYPE_SELECT = 'select'; + public const FIELD_TYPE_TEXT = 'text'; + public const FIELD_TYPE_TEXTAREA = 'textarea'; + public const TYPE_BOOL = 'bool'; + public const TYPE_DATE = 'date'; + public const TYPE_DATETIME = 'datetime'; + public const TYPE_ENUMERATION = 'enumeration'; + public const TYPE_NUMBER = 'number'; + public const TYPE_PHONE_NUMBER = 'phone_number'; + public const TYPE_STRING = 'string'; /** * Gets allowable values of the enum * * @return string[] */ - public function getTypeAllowableValues() + public function getFieldTypeAllowableValues() { return [ - self::TYPE_STRING, - self::TYPE_NUMBER, - self::TYPE_DATE, - self::TYPE_DATETIME, - self::TYPE_ENUMERATION, - self::TYPE_BOOL, + self::FIELD_TYPE_BOOLEANCHECKBOX, + self::FIELD_TYPE_CALCULATION_EQUATION, + self::FIELD_TYPE_CHECKBOX, + self::FIELD_TYPE_DATE, + self::FIELD_TYPE_FILE, + self::FIELD_TYPE_HTML, + self::FIELD_TYPE_NUMBER, + self::FIELD_TYPE_PHONENUMBER, + self::FIELD_TYPE_RADIO, + self::FIELD_TYPE_SELECT, + self::FIELD_TYPE_TEXT, + self::FIELD_TYPE_TEXTAREA, ]; } @@ -321,19 +330,16 @@ public function getTypeAllowableValues() * * @return string[] */ - public function getFieldTypeAllowableValues() + public function getTypeAllowableValues() { return [ - self::FIELD_TYPE_TEXTAREA, - self::FIELD_TYPE_TEXT, - self::FIELD_TYPE_DATE, - self::FIELD_TYPE_FILE, - self::FIELD_TYPE_NUMBER, - self::FIELD_TYPE_SELECT, - self::FIELD_TYPE_RADIO, - self::FIELD_TYPE_CHECKBOX, - self::FIELD_TYPE_BOOLEANCHECKBOX, - self::FIELD_TYPE_CALCULATION_EQUATION, + self::TYPE_BOOL, + self::TYPE_DATE, + self::TYPE_DATETIME, + self::TYPE_ENUMERATION, + self::TYPE_NUMBER, + self::TYPE_PHONE_NUMBER, + self::TYPE_STRING, ]; } @@ -352,16 +358,16 @@ public function getFieldTypeAllowableValues() */ public function __construct(?array $data = null) { + $this->setIfExists('calculation_formula', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('display_order', $data ?? [], null); + $this->setIfExists('field_type', $data ?? [], null); + $this->setIfExists('form_field', $data ?? [], null); $this->setIfExists('group_name', $data ?? [], null); $this->setIfExists('hidden', $data ?? [], null); - $this->setIfExists('options', $data ?? [], null); - $this->setIfExists('display_order', $data ?? [], null); - $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('calculation_formula', $data ?? [], null); $this->setIfExists('label', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('field_type', $data ?? [], null); - $this->setIfExists('form_field', $data ?? [], null); } /** @@ -391,20 +397,20 @@ public function listInvalidProperties() { $invalidProperties = []; - $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value '%s' for 'type', must be one of '%s'", - $this->container['type'], + "invalid value '%s' for 'field_type', must be one of '%s'", + $this->container['field_type'], implode("', '", $allowedValues) ); } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { $invalidProperties[] = sprintf( - "invalid value '%s' for 'field_type', must be one of '%s'", - $this->container['field_type'], + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], implode("', '", $allowedValues) ); } @@ -425,302 +431,302 @@ public function valid() /** - * Gets group_name + * Gets calculation_formula * * @return string|null */ - public function getGroupName() + public function getCalculationFormula() { - return $this->container['group_name']; + return $this->container['calculation_formula']; } /** - * Sets group_name + * Sets calculation_formula * - * @param string|null $group_name The name of the property group the property belongs to. + * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. * * @return self */ - public function setGroupName($group_name) + public function setCalculationFormula($calculation_formula) { - if (is_null($group_name)) { - throw new \InvalidArgumentException('non-nullable group_name cannot be null'); + if (is_null($calculation_formula)) { + throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); } - $this->container['group_name'] = $group_name; + $this->container['calculation_formula'] = $calculation_formula; return $this; } /** - * Gets hidden + * Gets description * - * @return bool|null + * @return string|null */ - public function getHidden() + public function getDescription() { - return $this->container['hidden']; + return $this->container['description']; } /** - * Sets hidden + * Sets description * - * @param bool|null $hidden If true, the property won't be visible and can't be used in HubSpot. + * @param string|null $description A description of the property that will be shown as help text in HubSpot. * * @return self */ - public function setHidden($hidden) + public function setDescription($description) { - if (is_null($hidden)) { - throw new \InvalidArgumentException('non-nullable hidden cannot be null'); + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); } - $this->container['hidden'] = $hidden; + $this->container['description'] = $description; return $this; } /** - * Gets options + * Gets display_order * - * @return \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null + * @return int|null */ - public function getOptions() + public function getDisplayOrder() { - return $this->container['options']; + return $this->container['display_order']; } /** - * Sets options + * Sets display_order * - * @param \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null $options A list of valid options for the property. + * @param int|null $display_order Property groups are displayed in order starting with the lowest positive integer value. Values of -1 will cause the property group to be displayed after any positive values. * * @return self */ - public function setOptions($options) + public function setDisplayOrder($display_order) { - if (is_null($options)) { - throw new \InvalidArgumentException('non-nullable options cannot be null'); + if (is_null($display_order)) { + throw new \InvalidArgumentException('non-nullable display_order cannot be null'); } - $this->container['options'] = $options; + $this->container['display_order'] = $display_order; return $this; } /** - * Gets display_order + * Gets field_type * - * @return int|null + * @return string|null */ - public function getDisplayOrder() + public function getFieldType() { - return $this->container['display_order']; + return $this->container['field_type']; } /** - * Sets display_order + * Sets field_type * - * @param int|null $display_order Properties are displayed in order starting with the lowest positive integer value. Values of -1 will cause the Property to be displayed after any positive values. + * @param string|null $field_type Controls how the property appears in HubSpot. * * @return self */ - public function setDisplayOrder($display_order) + public function setFieldType($field_type) { - if (is_null($display_order)) { - throw new \InvalidArgumentException('non-nullable display_order cannot be null'); + if (is_null($field_type)) { + throw new \InvalidArgumentException('non-nullable field_type cannot be null'); } - $this->container['display_order'] = $display_order; + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; return $this; } /** - * Gets description + * Gets form_field * - * @return string|null + * @return bool|null */ - public function getDescription() + public function getFormField() { - return $this->container['description']; + return $this->container['form_field']; } /** - * Sets description + * Sets form_field * - * @param string|null $description A description of the property that will be shown as help text in HubSpot. + * @param bool|null $form_field Whether or not the property can be used in a HubSpot form. * * @return self */ - public function setDescription($description) + public function setFormField($form_field) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); + if (is_null($form_field)) { + throw new \InvalidArgumentException('non-nullable form_field cannot be null'); } - $this->container['description'] = $description; + $this->container['form_field'] = $form_field; return $this; } /** - * Gets calculation_formula + * Gets group_name * * @return string|null */ - public function getCalculationFormula() + public function getGroupName() { - return $this->container['calculation_formula']; + return $this->container['group_name']; } /** - * Sets calculation_formula + * Sets group_name * - * @param string|null $calculation_formula Represents a formula that is used to compute a calculated property. + * @param string|null $group_name The name of the property group the property belongs to. * * @return self */ - public function setCalculationFormula($calculation_formula) + public function setGroupName($group_name) { - if (is_null($calculation_formula)) { - throw new \InvalidArgumentException('non-nullable calculation_formula cannot be null'); + if (is_null($group_name)) { + throw new \InvalidArgumentException('non-nullable group_name cannot be null'); } - $this->container['calculation_formula'] = $calculation_formula; + $this->container['group_name'] = $group_name; return $this; } /** - * Gets label + * Gets hidden * - * @return string|null + * @return bool|null */ - public function getLabel() + public function getHidden() { - return $this->container['label']; + return $this->container['hidden']; } /** - * Sets label + * Sets hidden * - * @param string|null $label A human-readable property label that will be shown in HubSpot. + * @param bool|null $hidden If true, the property won't be visible and can't be used in HubSpot. * * @return self */ - public function setLabel($label) + public function setHidden($hidden) { - if (is_null($label)) { - throw new \InvalidArgumentException('non-nullable label cannot be null'); + if (is_null($hidden)) { + throw new \InvalidArgumentException('non-nullable hidden cannot be null'); } - $this->container['label'] = $label; + $this->container['hidden'] = $hidden; return $this; } /** - * Gets type + * Gets label * * @return string|null */ - public function getType() + public function getLabel() { - return $this->container['type']; + return $this->container['label']; } /** - * Sets type + * Sets label * - * @param string|null $type The data type of the property. + * @param string|null $label A human-readable label that will be shown in HubSpot. * * @return self */ - public function setType($type) + public function setLabel($label) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $allowedValues = $this->getTypeAllowableValues(); - if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'type', must be one of '%s'", - $type, - implode("', '", $allowedValues) - ) - ); + if (is_null($label)) { + throw new \InvalidArgumentException('non-nullable label cannot be null'); } - $this->container['type'] = $type; + $this->container['label'] = $label; return $this; } /** - * Gets field_type + * Gets options * - * @return string|null + * @return \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null */ - public function getFieldType() + public function getOptions() { - return $this->container['field_type']; + return $this->container['options']; } /** - * Sets field_type + * Sets options * - * @param string|null $field_type Controls how the property appears in HubSpot. + * @param \HubSpot\Client\Crm\Properties\Model\OptionInput[]|null $options A list of valid options for the property. This field is required for enumerated properties. * * @return self */ - public function setFieldType($field_type) + public function setOptions($options) { - if (is_null($field_type)) { - throw new \InvalidArgumentException('non-nullable field_type cannot be null'); - } - $allowedValues = $this->getFieldTypeAllowableValues(); - if (!in_array($field_type, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'field_type', must be one of '%s'", - $field_type, - implode("', '", $allowedValues) - ) - ); + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); } - $this->container['field_type'] = $field_type; + $this->container['options'] = $options; return $this; } /** - * Gets form_field + * Gets type * - * @return bool|null + * @return string|null */ - public function getFormField() + public function getType() { - return $this->container['form_field']; + return $this->container['type']; } /** - * Sets form_field + * Sets type * - * @param bool|null $form_field Whether or not the property can be used in a HubSpot form. + * @param string|null $type The data type of the property. * * @return self */ - public function setFormField($form_field) + public function setType($type) { - if (is_null($form_field)) { - throw new \InvalidArgumentException('non-nullable form_field cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['form_field'] = $form_field; + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -728,12 +734,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -758,11 +764,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/Model/StandardError.php b/codegen/Crm/Properties/Model/StandardError.php index d1f8053e..9f6ad2ee 100644 --- a/codegen/Crm/Properties/Model/StandardError.php +++ b/codegen/Crm/Properties/Model/StandardError.php @@ -2,7 +2,7 @@ /** * StandardError * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * StandardError Class Doc Comment * * @category Class + * @description Ye olde error * @package HubSpot\Client\Crm\Properties * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,14 +58,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'object', + 'category' => 'string', 'context' => 'array', - 'links' => 'array', + 'errors' => '\HubSpot\Client\Crm\Properties\Model\ErrorDetail[]', 'id' => 'string', - 'category' => 'string', + 'links' => 'array', 'message' => 'string', - 'errors' => '\HubSpot\Client\Crm\Properties\Model\ErrorDetail[]', - 'status' => 'string' + 'status' => 'string', + 'sub_category' => 'object' ]; /** @@ -75,14 +76,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, - 'links' => null, + 'errors' => null, 'id' => null, - 'category' => null, + 'links' => null, 'message' => null, - 'errors' => null, - 'status' => null + 'status' => null, + 'sub_category' => null ]; /** @@ -91,14 +92,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, - 'links' => false, + 'errors' => false, 'id' => false, - 'category' => false, + 'links' => false, 'message' => false, - 'errors' => false, - 'status' => false + 'status' => false, + 'sub_category' => false ]; /** @@ -187,14 +188,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', - 'links' => 'links', + 'errors' => 'errors', 'id' => 'id', - 'category' => 'category', + 'links' => 'links', 'message' => 'message', - 'errors' => 'errors', - 'status' => 'status' + 'status' => 'status', + 'sub_category' => 'subCategory' ]; /** @@ -203,14 +204,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', - 'links' => 'setLinks', + 'errors' => 'setErrors', 'id' => 'setId', - 'category' => 'setCategory', + 'links' => 'setLinks', 'message' => 'setMessage', - 'errors' => 'setErrors', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'sub_category' => 'setSubCategory' ]; /** @@ -219,14 +220,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', - 'links' => 'getLinks', + 'errors' => 'getErrors', 'id' => 'getId', - 'category' => 'getCategory', + 'links' => 'getLinks', 'message' => 'getMessage', - 'errors' => 'getErrors', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'sub_category' => 'getSubCategory' ]; /** @@ -286,14 +287,14 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); - $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -323,21 +324,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['context'] === null) { $invalidProperties[] = "'context' can't be null"; } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } if ($this->container['links'] === null) { $invalidProperties[] = "'links' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -357,28 +358,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return object|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param object|null $sub_category sub_category + * @param string $category The main category of the error. * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -396,7 +397,7 @@ public function getContext() /** * Sets context * - * @param array $context context + * @param array $context Additional context-specific information related to the error. * * @return self */ @@ -411,28 +412,28 @@ public function setContext($context) } /** - * Gets links + * Gets errors * - * @return array + * @return \HubSpot\Client\Crm\Properties\Model\ErrorDetail[] */ - public function getLinks() + public function getErrors() { - return $this->container['links']; + return $this->container['errors']; } /** - * Sets links + * Sets errors * - * @param array $links links + * @param \HubSpot\Client\Crm\Properties\Model\ErrorDetail[] $errors The detailed error objects. * * @return self */ - public function setLinks($links) + public function setErrors($errors) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['links'] = $links; + $this->container['errors'] = $errors; return $this; } @@ -450,7 +451,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string|null $id A unique ID for the error instance. * * @return self */ @@ -465,28 +466,28 @@ public function setId($id) } /** - * Gets category + * Gets links * - * @return string + * @return array */ - public function getCategory() + public function getLinks() { - return $this->container['category']; + return $this->container['links']; } /** - * Sets category + * Sets links * - * @param string $category category + * @param array $links URLs linking to documentation or resources associated with the error. * * @return self */ - public function setCategory($category) + public function setLinks($links) { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['category'] = $category; + $this->container['links'] = $links; return $this; } @@ -504,7 +505,7 @@ public function getMessage() /** * Sets message * - * @param string $message message + * @param string $message A human-readable string describing the error and possible remediation steps. * * @return self */ @@ -519,66 +520,66 @@ public function setMessage($message) } /** - * Gets errors + * Gets status * - * @return \HubSpot\Client\Crm\Properties\Model\ErrorDetail[] + * @return string */ - public function getErrors() + public function getStatus() { - return $this->container['errors']; + return $this->container['status']; } /** - * Sets errors + * Sets status * - * @param \HubSpot\Client\Crm\Properties\Model\ErrorDetail[] $errors errors + * @param string $status The HTTP status code associated with the error. * * @return self */ - public function setErrors($errors) + public function setStatus($status) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $this->container['errors'] = $errors; + $this->container['status'] = $status; return $this; } /** - * Gets status + * Gets sub_category * - * @return string + * @return object|null */ - public function getStatus() + public function getSubCategory() { - return $this->container['status']; + return $this->container['sub_category']; } /** - * Sets status + * Sets sub_category * - * @param string $status status + * @param object|null $sub_category A more specific error category within each main category. * * @return self */ - public function setStatus($status) + public function setSubCategory($sub_category) { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['status'] = $status; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -586,12 +587,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -616,11 +617,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Properties/ObjectSerializer.php b/codegen/Crm/Properties/ObjectSerializer.php index 2a070e5c..c53b6cd9 100644 --- a/codegen/Crm/Properties/ObjectSerializer.php +++ b/codegen/Crm/Properties/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Properties @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -323,24 +323,6 @@ public static function toHeaderValue($value) return self::toString($value); } - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -612,6 +594,6 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } } - return $qs ? (string) substr($qs, 0, -1) : ''; + return $qs ? substr($qs, 0, -1) : ''; } }