diff --git a/codegen/Events/Api/EventsApi.php b/codegen/Events/Api/EventsApi.php index bca8c288..9e717f67 100644 --- a/codegen/Events/Api/EventsApi.php +++ b/codegen/Events/Api/EventsApi.php @@ -1,7 +1,7 @@ getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Events\Model\CollectionResponseExternalUnifiedEvent', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent', + $request, + $response, + ); default: - if ('\HubSpot\Client\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Events\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\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Events\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -274,34 +237,11 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af ); } - $returnType = '\HubSpot\Client\Events\Model\CollectionResponseExternalUnifiedEvent'; - 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\Events\Model\CollectionResponseExternalUnifiedEvent', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -311,7 +251,7 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -319,8 +259,10 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -328,20 +270,20 @@ public function getPageWithHttpInfo($object_type = null, $event_type = null, $af /** * Operation getPageAsync * - * Retrieve event data + * Retrieve event occurrences * - * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) - * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $object_type (optional) + * @param string|null $event_type (optional) * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string|null $before (optional) + * @param string|null $before (optional) * @param int|null $limit The maximum number of results to display per page. (optional) - * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) - * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) - * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) - * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) - * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) - * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) - * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string[]|null $sort (optional) + * @param \DateTime|null $occurred_after (optional) + * @param \DateTime|null $occurred_before (optional) + * @param int|null $object_id (optional) + * @param object|null $object_property_propname (optional) + * @param object|null $property_propname (optional) + * @param string[]|null $id (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -360,20 +302,20 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Retrieve event data + * Retrieve event occurrences * - * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) - * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $object_type (optional) + * @param string|null $event_type (optional) * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string|null $before (optional) + * @param string|null $before (optional) * @param int|null $limit The maximum number of results to display per page. (optional) - * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) - * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) - * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) - * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) - * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) - * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) - * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string[]|null $sort (optional) + * @param \DateTime|null $occurred_after (optional) + * @param \DateTime|null $occurred_before (optional) + * @param int|null $object_id (optional) + * @param object|null $object_property_propname (optional) + * @param object|null $property_propname (optional) + * @param string[]|null $id (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -423,18 +365,18 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string|null $object_type The type of CRM object to filter event instances on (e.g., `contact`). To retrieve event data for a specific CRM record, include the additional `objectId` query parameter (below). (optional) - * @param string|null $event_type The event type name. You can retrieve available event types using the [event types endpoint](#get-%2Fevents%2Fv3%2Fevents%2Fevent-types). (optional) + * @param string|null $object_type (optional) + * @param string|null $event_type (optional) * @param string|null $after The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. (optional) - * @param string|null $before (optional) + * @param string|null $before (optional) * @param int|null $limit The maximum number of results to display per page. (optional) - * @param string[]|null $sort Sort direction based on the timestamp of the event instance, `ASCENDING` or `DESCENDING`. (optional) - * @param \DateTime|null $occurred_after Filter for event data that occurred after a specific datetime. (optional) - * @param \DateTime|null $occurred_before Filter for event data that occurred before a specific datetime. (optional) - * @param int|null $object_id The ID of the CRM Object to filter event instances on. When including this parameter, you must also include the `objectType` parameter. (optional) - * @param object|null $object_property_propname Instead of retrieving event data for a specific object by its ID, you can specify a unique identifier property. For contacts, you can use the `email` property. (e.g., `objectProperty.email=name@domain.com`). (optional) - * @param object|null $property_propname Filter for event completions that contain a specific value for an event property (e.g., `property.hs_city=portland`). For properties values with spaces, replaces spaces with `%20` or `+` (e.g., `property.hs_city=new+york`). (optional) - * @param string[]|null $id ID of an event instance. IDs are 1:1 with event instances. If you provide this filter and additional filters, the other filters must match the values on the event instance to yield results. (optional) + * @param string[]|null $sort (optional) + * @param \DateTime|null $occurred_after (optional) + * @param \DateTime|null $occurred_before (optional) + * @param int|null $object_id (optional) + * @param object|null $object_property_propname (optional) + * @param object|null $property_propname (optional) + * @param string[]|null $id (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -635,7 +577,7 @@ public function getPageRequest($object_type = null, $event_type = null, $after = /** * Operation getTypes * - * Event Types + * Retrieve event types * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation * @@ -652,7 +594,7 @@ public function getTypes(string $contentType = self::contentTypes['getTypes'][0] /** * Operation getTypesWithHttpInfo * - * Event Types + * Retrieve event types * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation * @@ -689,61 +631,21 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g switch($statusCode) { case 200: - if ('\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_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\Events\Model\VisibleExternalEventTypeNames', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames', + $request, + $response, + ); default: - if ('\HubSpot\Client\Events\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Events\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\Events\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Events\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -757,34 +659,11 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g ); } - $returnType = '\HubSpot\Client\Events\Model\VisibleExternalEventTypeNames'; - 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\Events\Model\VisibleExternalEventTypeNames', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -794,7 +673,7 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -802,8 +681,10 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -811,7 +692,7 @@ public function getTypesWithHttpInfo(string $contentType = self::contentTypes['g /** * Operation getTypesAsync * - * Event Types + * Retrieve event types * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation * @@ -831,7 +712,7 @@ function ($response) { /** * Operation getTypesAsyncWithHttpInfo * - * Event Types + * Retrieve event types * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTypes'] to see the possible values for this operation * @@ -975,6 +856,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/Events/ApiException.php b/codegen/Events/ApiException.php index 8c33b187..e69bdddc 100644 --- a/codegen/Events/ApiException.php +++ b/codegen/Events/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/Events/FormDataProcessor.php b/codegen/Events/FormDataProcessor.php new file mode 100644 index 00000000..c47ab45e --- /dev/null +++ b/codegen/Events/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/Events/HeaderSelector.php b/codegen/Events/HeaderSelector.php index 5ecdd7e2..9024390f 100644 --- a/codegen/Events/HeaderSelector.php +++ b/codegen/Events/HeaderSelector.php @@ -1,7 +1,7 @@ container[$offset]); } @@ -367,12 +367,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +397,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Events/Model/Error.php b/codegen/Events/Model/Error.php index 897753ce..92dab8ea 100644 --- a/codegen/Events/Model/Error.php +++ b/codegen/Events/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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\Events\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Events\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\Events\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Events\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\Events\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\Events\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/Events/Model/ErrorDetail.php b/codegen/Events/Model/ErrorDetail.php index 1ece8c46..96a9784c 100644 --- a/codegen/Events/Model/ErrorDetail.php +++ b/codegen/Events/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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/Events/Model/ExternalUnifiedEvent.php b/codegen/Events/Model/ExternalUnifiedEvent.php index 44f0e022..93e6c6b2 100644 --- a/codegen/Events/Model/ExternalUnifiedEvent.php +++ b/codegen/Events/Model/ExternalUnifiedEvent.php @@ -2,7 +2,7 @@ /** * ExternalUnifiedEvent * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,12 +57,12 @@ class ExternalUnifiedEvent implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'occurred_at' => '\DateTime', 'event_type' => 'string', 'id' => 'string', 'object_id' => 'string', - 'properties' => 'array', - 'object_type' => 'string' + 'object_type' => 'string', + 'occurred_at' => '\DateTime', + 'properties' => 'array' ]; /** @@ -73,12 +73,12 @@ class ExternalUnifiedEvent implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'occurred_at' => 'date-time', 'event_type' => null, 'id' => null, 'object_id' => null, - 'properties' => null, - 'object_type' => null + 'object_type' => null, + 'occurred_at' => 'date-time', + 'properties' => null ]; /** @@ -87,12 +87,12 @@ class ExternalUnifiedEvent implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'occurred_at' => false, 'event_type' => false, 'id' => false, 'object_id' => false, - 'properties' => false, - 'object_type' => false + 'object_type' => false, + 'occurred_at' => false, + 'properties' => false ]; /** @@ -181,12 +181,12 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'occurred_at' => 'occurredAt', 'event_type' => 'eventType', 'id' => 'id', 'object_id' => 'objectId', - 'properties' => 'properties', - 'object_type' => 'objectType' + 'object_type' => 'objectType', + 'occurred_at' => 'occurredAt', + 'properties' => 'properties' ]; /** @@ -195,12 +195,12 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'occurred_at' => 'setOccurredAt', 'event_type' => 'setEventType', 'id' => 'setId', 'object_id' => 'setObjectId', - 'properties' => 'setProperties', - 'object_type' => 'setObjectType' + 'object_type' => 'setObjectType', + 'occurred_at' => 'setOccurredAt', + 'properties' => 'setProperties' ]; /** @@ -209,12 +209,12 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'occurred_at' => 'getOccurredAt', 'event_type' => 'getEventType', 'id' => 'getId', 'object_id' => 'getObjectId', - 'properties' => 'getProperties', - 'object_type' => 'getObjectType' + 'object_type' => 'getObjectType', + 'occurred_at' => 'getOccurredAt', + 'properties' => 'getProperties' ]; /** @@ -274,12 +274,12 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('occurred_at', $data ?? [], null); $this->setIfExists('event_type', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('object_id', $data ?? [], null); - $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('object_type', $data ?? [], null); + $this->setIfExists('occurred_at', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); } /** @@ -309,9 +309,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['occurred_at'] === null) { - $invalidProperties[] = "'occurred_at' can't be null"; - } if ($this->container['event_type'] === null) { $invalidProperties[] = "'event_type' can't be null"; } @@ -324,6 +321,12 @@ public function listInvalidProperties() if ($this->container['object_type'] === null) { $invalidProperties[] = "'object_type' can't be null"; } + if ($this->container['occurred_at'] === null) { + $invalidProperties[] = "'occurred_at' can't be null"; + } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } return $invalidProperties; } @@ -339,33 +342,6 @@ public function valid() } - /** - * Gets occurred_at - * - * @return \DateTime - */ - public function getOccurredAt() - { - return $this->container['occurred_at']; - } - - /** - * Sets occurred_at - * - * @param \DateTime $occurred_at An ISO 8601 timestamp when the event occurred. - * - * @return self - */ - public function setOccurredAt($occurred_at) - { - if (is_null($occurred_at)) { - throw new \InvalidArgumentException('non-nullable occurred_at cannot be null'); - } - $this->container['occurred_at'] = $occurred_at; - - return $this; - } - /** * Gets event_type * @@ -448,66 +424,93 @@ public function setObjectId($object_id) } /** - * Gets properties + * Gets object_type * - * @return array|null + * @return string */ - public function getProperties() + public function getObjectType() { - return $this->container['properties']; + return $this->container['object_type']; } /** - * Sets properties + * Sets object_type * - * @param array|null $properties properties + * @param string $object_type The objectType for the object which did the event. * * @return self */ - public function setProperties($properties) + public function setObjectType($object_type) { - if (is_null($properties)) { - throw new \InvalidArgumentException('non-nullable properties cannot be null'); + if (is_null($object_type)) { + throw new \InvalidArgumentException('non-nullable object_type cannot be null'); } - $this->container['properties'] = $properties; + $this->container['object_type'] = $object_type; return $this; } /** - * Gets object_type + * Gets occurred_at * - * @return string + * @return \DateTime */ - public function getObjectType() + public function getOccurredAt() { - return $this->container['object_type']; + return $this->container['occurred_at']; } /** - * Sets object_type + * Sets occurred_at * - * @param string $object_type The objectType for the object which did the event. + * @param \DateTime $occurred_at An ISO 8601 timestamp when the event occurred. * * @return self */ - public function setObjectType($object_type) + public function setOccurredAt($occurred_at) { - if (is_null($object_type)) { - throw new \InvalidArgumentException('non-nullable object_type cannot be null'); + if (is_null($occurred_at)) { + throw new \InvalidArgumentException('non-nullable occurred_at cannot be null'); } - $this->container['object_type'] = $object_type; + $this->container['occurred_at'] = $occurred_at; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties A key-value map of event-specific properties. The available properties depend on the event type definition. + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -515,12 +518,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; } @@ -545,11 +548,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/Events/Model/ModelInterface.php b/codegen/Events/Model/ModelInterface.php index 956030e8..4efec836 100644 --- a/codegen/Events/Model/ModelInterface.php +++ b/codegen/Events/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Model @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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/Events/Model/NextPage.php b/codegen/Events/Model/NextPage.php index cb6fef51..1df3c635 100644 --- a/codegen/Events/Model/NextPage.php +++ b/codegen/Events/Model/NextPage.php @@ -2,7 +2,7 @@ /** * NextPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * NextPage Class Doc Comment * * @category Class + * @description Specifies the paging information needed to retrieve the next set of results in a paginated API response * @package HubSpot\Client\Events * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,8 +58,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'link' => 'string', - 'after' => 'string' + 'after' => 'string', + 'link' => 'string' ]; /** @@ -69,8 +70,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'link' => null, - 'after' => null + 'after' => null, + 'link' => null ]; /** @@ -79,8 +80,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'link' => false, - 'after' => false + 'after' => false, + 'link' => false ]; /** @@ -169,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'link' => 'link', - 'after' => 'after' + 'after' => 'after', + 'link' => 'link' ]; /** @@ -179,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'link' => 'setLink', - 'after' => 'setAfter' + 'after' => 'setAfter', + 'link' => 'setLink' ]; /** @@ -189,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'link' => 'getLink', - 'after' => 'getAfter' + 'after' => 'getAfter', + 'link' => 'getLink' ]; /** @@ -250,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); } /** @@ -300,66 +301,66 @@ public function valid() /** - * Gets link + * Gets after * - * @return string|null + * @return string */ - public function getLink() + public function getAfter() { - return $this->container['link']; + return $this->container['after']; } /** - * Sets link + * Sets after * - * @param string|null $link + * @param string $after A paging cursor token for retrieving subsequent pages. * * @return self */ - public function setLink($link) + public function setAfter($after) { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); } - $this->container['link'] = $link; + $this->container['after'] = $after; return $this; } /** - * Gets after + * Gets link * - * @return string + * @return string|null */ - public function getAfter() + public function getLink() { - return $this->container['after']; + return $this->container['link']; } /** - * Sets after + * Sets link * - * @param string $after + * @param string|null $link A URL that can be used to retrieve the next page results. * * @return self */ - public function setAfter($after) + public function setLink($link) { - if (is_null($after)) { - throw new \InvalidArgumentException('non-nullable after cannot be null'); + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); } - $this->container['after'] = $after; + $this->container['link'] = $link; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -367,12 +368,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +398,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Events/Model/Paging.php b/codegen/Events/Model/Paging.php index 0b7817ad..d969eab2 100644 --- a/codegen/Events/Model/Paging.php +++ b/codegen/Events/Model/Paging.php @@ -2,7 +2,7 @@ /** * Paging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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 setPrev($prev) /** * 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/Events/Model/PreviousPage.php b/codegen/Events/Model/PreviousPage.php index a74f0dbb..44883839 100644 --- a/codegen/Events/Model/PreviousPage.php +++ b/codegen/Events/Model/PreviousPage.php @@ -2,7 +2,7 @@ /** * PreviousPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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 @@ * PreviousPage Class Doc Comment * * @category Class + * @description specifies the paging information needed to retrieve the previous set of results in a paginated API response * @package HubSpot\Client\Events * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -312,7 +313,7 @@ public function getBefore() /** * Sets before * - * @param string $before before + * @param string $before A paging cursor token for retrieving previous pages. * * @return self */ @@ -339,7 +340,7 @@ public function getLink() /** * Sets link * - * @param string|null $link link + * @param string|null $link A URL that can be used to retrieve the previous pages' results. * * @return self */ @@ -355,11 +356,11 @@ public function setLink($link) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -367,12 +368,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +398,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Events/Model/VisibleExternalEventTypeNames.php b/codegen/Events/Model/VisibleExternalEventTypeNames.php index 3a8c20dc..a9415ee1 100644 --- a/codegen/Events/Model/VisibleExternalEventTypeNames.php +++ b/codegen/Events/Model/VisibleExternalEventTypeNames.php @@ -2,7 +2,7 @@ /** * VisibleExternalEventTypeNames * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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 setEventTypes($event_types) /** * 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/Events/ObjectSerializer.php b/codegen/Events/ObjectSerializer.php index 000cf5ee..4d35b121 100644 --- a/codegen/Events/ObjectSerializer.php +++ b/codegen/Events/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events @@ -13,11 +13,11 @@ /** * Events Events * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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) : ''; } } diff --git a/codegen/Events/Send/Api/BasicApi.php b/codegen/Events/Send/Api/BasicApi.php index d5ee60a8..6f2c116f 100644 --- a/codegen/Events/Send/Api/BasicApi.php +++ b/codegen/Events/Send/Api/BasicApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -189,8 +191,10 @@ public function sendWithHttpInfo($behavioral_event_http_completion_request, stri $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -198,7 +202,7 @@ public function sendWithHttpInfo($behavioral_event_http_completion_request, stri /** * Operation sendAsync * - * Send a custom event completion + * Send a custom event occurrence * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -219,7 +223,7 @@ function ($response) { /** * Operation sendAsyncWithHttpInfo * - * Send a custom event completion + * Send a custom event occurrence * * @param \HubSpot\Client\Events\Send\Model\BehavioralEventHttpCompletionRequest $behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -366,6 +370,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/Events/Send/Api/BatchApi.php b/codegen/Events/Send/Api/BatchApi.php index 321f6e88..5b1f7ec3 100644 --- a/codegen/Events/Send/Api/BatchApi.php +++ b/codegen/Events/Send/Api/BatchApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -189,8 +191,10 @@ public function sendWithHttpInfo($batched_behavioral_event_http_completion_reque $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -198,7 +202,7 @@ public function sendWithHttpInfo($batched_behavioral_event_http_completion_reque /** * Operation sendAsync * - * Send a batch of event completions + * Send a batch of event occurrences * * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -219,7 +223,7 @@ function ($response) { /** * Operation sendAsyncWithHttpInfo * - * Send a batch of event completions + * Send a batch of event occurrences * * @param \HubSpot\Client\Events\Send\Model\BatchedBehavioralEventHttpCompletionRequest $batched_behavioral_event_http_completion_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['send'] to see the possible values for this operation @@ -366,6 +370,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/Events/Send/ApiException.php b/codegen/Events/Send/ApiException.php index 54995f53..16c3b6c9 100644 --- a/codegen/Events/Send/ApiException.php +++ b/codegen/Events/Send/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/Events/Send/FormDataProcessor.php b/codegen/Events/Send/FormDataProcessor.php new file mode 100644 index 00000000..e74fcef0 --- /dev/null +++ b/codegen/Events/Send/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/Events/Send/HeaderSelector.php b/codegen/Events/Send/HeaderSelector.php index 89a6000e..b63704e7 100644 --- a/codegen/Events/Send/HeaderSelector.php +++ b/codegen/Events/Send/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/Events/Send/Model/BehavioralEventHttpCompletionRequest.php b/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php index e9e62d99..28e3f130 100644 --- a/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php +++ b/codegen/Events/Send/Model/BehavioralEventHttpCompletionRequest.php @@ -2,7 +2,7 @@ /** * BehavioralEventHttpCompletionRequest * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Send @@ -13,11 +13,11 @@ /** * Events Send Event Completions * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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 BehavioralEventHttpCompletionRequest implements ModelInterface, ArrayAcces * @var string[] */ protected static $openAPITypes = [ - 'occurred_at' => '\DateTime', - 'event_name' => 'string', - 'utk' => 'string', - 'uuid' => 'string', 'email' => 'string', + 'event_name' => 'string', + 'object_id' => 'string', + 'occurred_at' => '\DateTime', 'properties' => 'array', - 'object_id' => 'string' + 'utk' => 'string', + 'uuid' => 'string' ]; /** @@ -74,13 +74,13 @@ class BehavioralEventHttpCompletionRequest implements ModelInterface, ArrayAcces * @psalm-var array */ protected static $openAPIFormats = [ - 'occurred_at' => 'date-time', - 'event_name' => null, - 'utk' => null, - 'uuid' => null, 'email' => null, + 'event_name' => null, + 'object_id' => null, + 'occurred_at' => 'date-time', 'properties' => null, - 'object_id' => null + 'utk' => null, + 'uuid' => null ]; /** @@ -89,13 +89,13 @@ class BehavioralEventHttpCompletionRequest implements ModelInterface, ArrayAcces * @var boolean[] */ protected static array $openAPINullables = [ - 'occurred_at' => false, - 'event_name' => false, - 'utk' => false, - 'uuid' => false, 'email' => false, + 'event_name' => false, + 'object_id' => false, + 'occurred_at' => false, 'properties' => false, - 'object_id' => false + 'utk' => false, + 'uuid' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'occurred_at' => 'occurredAt', - 'event_name' => 'eventName', - 'utk' => 'utk', - 'uuid' => 'uuid', 'email' => 'email', + 'event_name' => 'eventName', + 'object_id' => 'objectId', + 'occurred_at' => 'occurredAt', 'properties' => 'properties', - 'object_id' => 'objectId' + 'utk' => 'utk', + 'uuid' => 'uuid' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'occurred_at' => 'setOccurredAt', - 'event_name' => 'setEventName', - 'utk' => 'setUtk', - 'uuid' => 'setUuid', 'email' => 'setEmail', + 'event_name' => 'setEventName', + 'object_id' => 'setObjectId', + 'occurred_at' => 'setOccurredAt', 'properties' => 'setProperties', - 'object_id' => 'setObjectId' + 'utk' => 'setUtk', + 'uuid' => 'setUuid' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'occurred_at' => 'getOccurredAt', - 'event_name' => 'getEventName', - 'utk' => 'getUtk', - 'uuid' => 'getUuid', 'email' => 'getEmail', + 'event_name' => 'getEventName', + 'object_id' => 'getObjectId', + 'occurred_at' => 'getOccurredAt', 'properties' => 'getProperties', - 'object_id' => 'getObjectId' + 'utk' => 'getUtk', + 'uuid' => 'getUuid' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('occurred_at', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); $this->setIfExists('event_name', $data ?? [], null); + $this->setIfExists('object_id', $data ?? [], null); + $this->setIfExists('occurred_at', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('utk', $data ?? [], null); $this->setIfExists('uuid', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('properties', $data ?? [], null); - $this->setIfExists('object_id', $data ?? [], null); } /** @@ -319,6 +319,9 @@ public function listInvalidProperties() if ($this->container['event_name'] === null) { $invalidProperties[] = "'event_name' can't be null"; } + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } return $invalidProperties; } @@ -335,28 +338,28 @@ public function valid() /** - * Gets occurred_at + * Gets email * - * @return \DateTime|null + * @return string|null */ - public function getOccurredAt() + public function getEmail() { - return $this->container['occurred_at']; + return $this->container['email']; } /** - * Sets occurred_at + * Sets email * - * @param \DateTime|null $occurred_at The time when this event occurred. If this isn't set, the current time will be used. + * @param string|null $email The visitor's email address. Used for associating the event data with a CRM record. * * @return self */ - public function setOccurredAt($occurred_at) + public function setEmail($email) { - if (is_null($occurred_at)) { - throw new \InvalidArgumentException('non-nullable occurred_at cannot be null'); + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); } - $this->container['occurred_at'] = $occurred_at; + $this->container['email'] = $email; return $this; } @@ -374,7 +377,7 @@ public function getEventName() /** * Sets event_name * - * @param string $event_name The internal name of the event (`pe_eventName`). Can be retrieved through the [event definitions API](https://developers.hubspot.com/docs/reference/api/analytics-and-events/custom-events/custom-event-definitions#get-%2Fevents%2Fv3%2Fevent-definitions) or in [HubSpot's UI](https://knowledge.hubspot.com/reports/create-custom-behavioral-events-with-the-code-wizard#find-internal-name). + * @param string $event_name The event's fully qualified name. This value (formatted as `pe{HubID}_{name}`) can be retrieved through the [event definitions API](https://developers.hubspot.com/docs/reference/api/analytics-and-events/custom-events/custom-event-definitions#get-%2Fevents%2Fv3%2Fevent-definitions) or in [HubSpot's UI](https://knowledge.hubspot.com/reports/create-custom-behavioral-events-with-the-code-wizard#find-internal-name). * * @return self */ @@ -389,147 +392,147 @@ public function setEventName($event_name) } /** - * Gets utk + * Gets object_id * * @return string|null */ - public function getUtk() + public function getObjectId() { - return $this->container['utk']; + return $this->container['object_id']; } /** - * Sets utk + * Sets object_id * - * @param string|null $utk The visitor's usertoken. Used for associating the event data with a CRM record. + * @param string|null $object_id The ID of the record for which the event occurred (e.g., contact ID or visitor ID). * * @return self */ - public function setUtk($utk) + public function setObjectId($object_id) { - if (is_null($utk)) { - throw new \InvalidArgumentException('non-nullable utk cannot be null'); + if (is_null($object_id)) { + throw new \InvalidArgumentException('non-nullable object_id cannot be null'); } - $this->container['utk'] = $utk; + $this->container['object_id'] = $object_id; return $this; } /** - * Gets uuid + * Gets occurred_at * - * @return string|null + * @return \DateTime|null */ - public function getUuid() + public function getOccurredAt() { - return $this->container['uuid']; + return $this->container['occurred_at']; } /** - * Sets uuid + * Sets occurred_at * - * @param string|null $uuid Include a universally unique identifier to assign a unique ID to the event completion. Can be useful for matching data between HubSpot and other external systems. + * @param \DateTime|null $occurred_at The time when this event occurred. If this isn't set, the current time will be used. * * @return self */ - public function setUuid($uuid) + public function setOccurredAt($occurred_at) { - if (is_null($uuid)) { - throw new \InvalidArgumentException('non-nullable uuid cannot be null'); + if (is_null($occurred_at)) { + throw new \InvalidArgumentException('non-nullable occurred_at cannot be null'); } - $this->container['uuid'] = $uuid; + $this->container['occurred_at'] = $occurred_at; return $this; } /** - * Gets email + * Gets properties * - * @return string|null + * @return array */ - public function getEmail() + public function getProperties() { - return $this->container['email']; + return $this->container['properties']; } /** - * Sets email + * Sets properties * - * @param string|null $email The visitor's email address. Used for associating the event data with a CRM record. + * @param array $properties The event properties to update. Takes the format of key-value pairs (property internal name and property value). Learn more about [HubSpot's default event properties](https://developers.hubspot.com/docs/guides/api/analytics-and-events/custom-events/custom-event-definitions#hubspot-s-default-event-properties). * * @return self */ - public function setEmail($email) + public function setProperties($properties) { - if (is_null($email)) { - throw new \InvalidArgumentException('non-nullable email cannot be null'); + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); } - $this->container['email'] = $email; + $this->container['properties'] = $properties; return $this; } /** - * Gets properties + * Gets utk * - * @return array|null + * @return string|null */ - public function getProperties() + public function getUtk() { - return $this->container['properties']; + return $this->container['utk']; } /** - * Sets properties + * Sets utk * - * @param array|null $properties The event properties to update. Takes the format of key-value pairs (property internal name and property value). Learn more about [HubSpot's default event properties](https://developers.hubspot.com/docs/guides/api/analytics-and-events/custom-events/custom-event-definitions#hubspot-s-default-event-properties). + * @param string|null $utk The visitor's usertoken. Used for associating the event data with a CRM record. * * @return self */ - public function setProperties($properties) + public function setUtk($utk) { - if (is_null($properties)) { - throw new \InvalidArgumentException('non-nullable properties cannot be null'); + if (is_null($utk)) { + throw new \InvalidArgumentException('non-nullable utk cannot be null'); } - $this->container['properties'] = $properties; + $this->container['utk'] = $utk; return $this; } /** - * Gets object_id + * Gets uuid * * @return string|null */ - public function getObjectId() + public function getUuid() { - return $this->container['object_id']; + return $this->container['uuid']; } /** - * Sets object_id + * Sets uuid * - * @param string|null $object_id The ID of the object that completed the event (e.g., contact ID or visitor ID). + * @param string|null $uuid Include a universally unique identifier to assign a unique ID to the event occurrence. Can be useful for matching data between HubSpot and other external systems. * * @return self */ - public function setObjectId($object_id) + public function setUuid($uuid) { - if (is_null($object_id)) { - throw new \InvalidArgumentException('non-nullable object_id cannot be null'); + if (is_null($uuid)) { + throw new \InvalidArgumentException('non-nullable uuid cannot be null'); } - $this->container['object_id'] = $object_id; + $this->container['uuid'] = $uuid; 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]); } @@ -537,12 +540,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; } @@ -567,11 +570,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/Events/Send/Model/Error.php b/codegen/Events/Send/Model/Error.php index 95f0407a..77def886 100644 --- a/codegen/Events/Send/Model/Error.php +++ b/codegen/Events/Send/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Send @@ -13,11 +13,11 @@ /** * Events Send Event Completions * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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\Events\Send\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Events\Send\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\Events\Send\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Events\Send\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\Events\Send\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\Events\Send\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/Events/Send/Model/ErrorDetail.php b/codegen/Events/Send/Model/ErrorDetail.php index 2751ca40..1ca7eaea 100644 --- a/codegen/Events/Send/Model/ErrorDetail.php +++ b/codegen/Events/Send/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Send @@ -13,11 +13,11 @@ /** * Events Send Event Completions * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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/Events/Send/Model/ModelInterface.php b/codegen/Events/Send/Model/ModelInterface.php index a74b8eba..2922b83a 100644 --- a/codegen/Events/Send/Model/ModelInterface.php +++ b/codegen/Events/Send/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Send\Model @@ -13,11 +13,11 @@ /** * Events Send Event Completions * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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/Events/Send/ObjectSerializer.php b/codegen/Events/Send/ObjectSerializer.php index 784f89cf..a73cbe62 100644 --- a/codegen/Events/Send/ObjectSerializer.php +++ b/codegen/Events/Send/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Events\Send @@ -13,11 +13,11 @@ /** * Events Send Event Completions * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * Basepom for all HubSpot Projects * * 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) : ''; } }