From dbf9e49b1d65688683c8510aa974aacfd8ee89ce Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Mon, 2 Feb 2026 16:10:56 +0300 Subject: [PATCH] Codegen: CRM Owners --- codegen/Crm/Owners/Api/OwnersApi.php | 300 +++++++---------- codegen/Crm/Owners/ApiException.php | 4 +- codegen/Crm/Owners/Configuration.php | 63 +++- codegen/Crm/Owners/FormDataProcessor.php | 246 ++++++++++++++ codegen/Crm/Owners/HeaderSelector.php | 4 +- ...ectionResponsePublicOwnerForwardPaging.php | 16 +- codegen/Crm/Owners/Model/Error.php | 158 ++++----- codegen/Crm/Owners/Model/ErrorDetail.php | 134 ++++---- codegen/Crm/Owners/Model/ForwardPaging.php | 16 +- codegen/Crm/Owners/Model/ModelInterface.php | 4 +- codegen/Crm/Owners/Model/NextPage.php | 83 ++--- codegen/Crm/Owners/Model/PublicOwner.php | 306 +++++++++--------- codegen/Crm/Owners/Model/PublicTeam.php | 72 ++--- codegen/Crm/Owners/ObjectSerializer.php | 24 +- 14 files changed, 824 insertions(+), 606 deletions(-) create mode 100644 codegen/Crm/Owners/FormDataProcessor.php diff --git a/codegen/Crm/Owners/Api/OwnersApi.php b/codegen/Crm/Owners/Api/OwnersApi.php index df6596c5..0acf8b41 100644 --- a/codegen/Crm/Owners/Api/OwnersApi.php +++ b/codegen/Crm/Owners/Api/OwnersApi.php @@ -1,7 +1,7 @@ getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Owners\Model\PublicOwner' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Owners\Model\PublicOwner', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\PublicOwner', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Owners\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Owners\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Owners\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -256,34 +219,11 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = ); } - $returnType = '\HubSpot\Client\Crm\Owners\Model\PublicOwner'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\PublicOwner', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -293,7 +233,7 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -301,8 +241,10 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -310,10 +252,10 @@ public function getByIdWithHttpInfo($owner_id, $id_property = 'id', $archived = /** * Operation getByIdAsync * - * Read an owner by given `id` or `userId` + * Retrieve a specific owner by ID * - * @param int $owner_id (required) - * @param string|null $id_property (optional, default to 'id') + * @param int $owner_id (required) + * @param string|null $id_property (optional, default to 'id') * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * @@ -333,10 +275,10 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Read an owner by given `id` or `userId` + * Retrieve a specific owner by ID * - * @param int $owner_id (required) - * @param string|null $id_property (optional, default to 'id') + * @param int $owner_id (required) + * @param string|null $id_property (optional, default to 'id') * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * @@ -387,8 +329,8 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param int $owner_id (required) - * @param string|null $id_property (optional, default to 'id') + * @param int $owner_id (required) + * @param string|null $id_property (optional, default to 'id') * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * @@ -505,7 +447,7 @@ public function getByIdRequest($owner_id, $id_property = 'id', $archived = false /** * Operation getPage * - * Get a page of owners + * Retrieve a paginated list of owners available in the account. * * @param string|null $email Filter by email address (optional) (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) @@ -526,7 +468,7 @@ public function getPage($email = null, $after = null, $limit = 100, $archived = /** * Operation getPageWithHttpInfo * - * Get a page of owners + * Retrieve a paginated list of owners available in the account. * * @param string|null $email Filter by email address (optional) (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) @@ -567,61 +509,21 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, switch($statusCode) { case 200: - if ('\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', + $request, + $response, + ); default: - if ('\HubSpot\Client\Crm\Owners\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Owners\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Owners\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -635,34 +537,11 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, ); } - $returnType = '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Owners\Model\CollectionResponsePublicOwnerForwardPaging', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -672,7 +551,7 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -680,8 +559,10 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -689,7 +570,7 @@ public function getPageWithHttpInfo($email = null, $after = null, $limit = 100, /** * Operation getPageAsync * - * Get a page of owners + * Retrieve a paginated list of owners available in the account. * * @param string|null $email Filter by email address (optional) (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) @@ -713,7 +594,7 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * Get a page of owners + * Retrieve a paginated list of owners available in the account. * * @param string|null $email Filter by email address (optional) (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) @@ -905,6 +786,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Crm/Owners/ApiException.php b/codegen/Crm/Owners/ApiException.php index a7723fb5..60def824 100644 --- a/codegen/Crm/Owners/ApiException.php +++ b/codegen/Crm/Owners/ApiException.php @@ -1,7 +1,7 @@ tempFolderPath; } + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + /** * Gets the default configuration instance * diff --git a/codegen/Crm/Owners/FormDataProcessor.php b/codegen/Crm/Owners/FormDataProcessor.php new file mode 100644 index 00000000..49e335d5 --- /dev/null +++ b/codegen/Crm/Owners/FormDataProcessor.php @@ -0,0 +1,246 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/codegen/Crm/Owners/HeaderSelector.php b/codegen/Crm/Owners/HeaderSelector.php index f10208c7..c9406a4e 100644 --- a/codegen/Crm/Owners/HeaderSelector.php +++ b/codegen/Crm/Owners/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/Crm/Owners/Model/Error.php b/codegen/Crm/Owners/Model/Error.php index 791032eb..304431f3 100644 --- a/codegen/Crm/Owners/Model/Error.php +++ b/codegen/Crm/Owners/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,13 +57,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\Crm\Owners\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Crm\Owners\Model\ErrorDetail[]' + 'sub_category' => 'string' ]; /** @@ -74,13 +74,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, 'correlation_id' => 'uuid', + 'errors' => null, 'links' => null, 'message' => null, - 'category' => null, - 'errors' => null + 'sub_category' => null ]; /** @@ -89,13 +89,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, 'correlation_id' => false, + 'errors' => false, 'links' => false, 'message' => false, - 'category' => false, - 'errors' => false + 'sub_category' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', 'correlation_id' => 'correlationId', + 'errors' => 'errors', 'links' => 'links', 'message' => 'message', - 'category' => 'category', - 'errors' => 'errors' + 'sub_category' => 'subCategory' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', 'correlation_id' => 'setCorrelationId', + 'errors' => 'setErrors', 'links' => 'setLinks', 'message' => 'setMessage', - 'category' => 'setCategory', - 'errors' => 'setErrors' + 'sub_category' => 'setSubCategory' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', 'correlation_id' => 'getCorrelationId', + 'errors' => 'getErrors', 'links' => 'getLinks', 'message' => 'getMessage', - 'category' => 'getCategory', - 'errors' => 'getErrors' + 'sub_category' => 'getSubCategory' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -316,15 +316,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['correlation_id'] === null) { $invalidProperties[] = "'correlation_id' can't be null"; } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } return $invalidProperties; } @@ -341,28 +341,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return string|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string $category The error category * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -421,6 +421,33 @@ public function setCorrelationId($correlation_id) return $this; } + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Owners\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Owners\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** * Gets links * @@ -476,66 +503,39 @@ public function setMessage($message) } /** - * Gets category - * - * @return string - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string $category The error category - * - * @return self - */ - public function setCategory($category) - { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); - } - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets errors + * Gets sub_category * - * @return \HubSpot\Client\Crm\Owners\Model\ErrorDetail[]|null + * @return string|null */ - public function getErrors() + public function getSubCategory() { - return $this->container['errors']; + return $this->container['sub_category']; } /** - * Sets errors + * Sets sub_category * - * @param \HubSpot\Client\Crm\Owners\Model\ErrorDetail[]|null $errors further information about the error + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setErrors($errors) + public function setSubCategory($sub_category) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['errors'] = $errors; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -543,12 +543,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -573,11 +573,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Owners/Model/ErrorDetail.php b/codegen/Crm/Owners/Model/ErrorDetail.php index 72f53989..8421782b 100644 --- a/codegen/Crm/Owners/Model/ErrorDetail.php +++ b/codegen/Crm/Owners/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,11 +57,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', 'code' => 'string', - 'in' => 'string', 'context' => 'array', - 'message' => 'string' + 'in' => 'string', + 'message' => 'string', + 'sub_category' => 'string' ]; /** @@ -72,11 +72,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, 'code' => null, - 'in' => null, 'context' => null, - 'message' => null + 'in' => null, + 'message' => null, + 'sub_category' => null ]; /** @@ -85,11 +85,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, 'code' => false, - 'in' => false, 'context' => false, - 'message' => false + 'in' => false, + 'message' => false, + 'sub_category' => false ]; /** @@ -178,11 +178,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', 'code' => 'code', - 'in' => 'in', 'context' => 'context', - 'message' => 'message' + 'in' => 'in', + 'message' => 'message', + 'sub_category' => 'subCategory' ]; /** @@ -191,11 +191,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', 'code' => 'setCode', - 'in' => 'setIn', 'context' => 'setContext', - 'message' => 'setMessage' + 'in' => 'setIn', + 'message' => 'setMessage', + 'sub_category' => 'setSubCategory' ]; /** @@ -204,11 +204,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', 'code' => 'getCode', - 'in' => 'getIn', 'context' => 'getContext', - 'message' => 'getMessage' + 'in' => 'getIn', + 'message' => 'getMessage', + 'sub_category' => 'getSubCategory' ]; /** @@ -268,11 +268,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -321,55 +321,55 @@ public function valid() /** - * Gets sub_category + * Gets code * * @return string|null */ - public function getSubCategory() + public function getCode() { - return $this->container['sub_category']; + return $this->container['code']; } /** - * Sets sub_category + * Sets code * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $code The status code associated with the error detail * * @return self */ - public function setSubCategory($sub_category) + public function setCode($code) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['code'] = $code; return $this; } /** - * Gets code + * Gets context * - * @return string|null + * @return array|null */ - public function getCode() + public function getContext() { - return $this->container['code']; + return $this->container['context']; } /** - * Sets code + * Sets context * - * @param string|null $code The status code associated with the error detail + * @param array|null $context Context about the error condition * * @return self */ - public function setCode($code) + public function setContext($context) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); } - $this->container['code'] = $code; + $this->container['context'] = $context; return $this; } @@ -402,66 +402,66 @@ public function setIn($in) } /** - * Gets context + * Gets message * - * @return array|null + * @return string */ - public function getContext() + public function getMessage() { - return $this->container['context']; + return $this->container['message']; } /** - * Sets context + * Sets message * - * @param array|null $context Context about the error condition + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setContext($context) + public function setMessage($message) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['context'] = $context; + $this->container['message'] = $message; return $this; } /** - * Gets message + * Gets sub_category * - * @return string + * @return string|null */ - public function getMessage() + public function getSubCategory() { - return $this->container['message']; + return $this->container['sub_category']; } /** - * Sets message + * Sets sub_category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setMessage($message) + public function setSubCategory($sub_category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['message'] = $message; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -469,12 +469,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -499,11 +499,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Owners/Model/ForwardPaging.php b/codegen/Crm/Owners/Model/ForwardPaging.php index fb6c5413..ca5a6f93 100644 --- a/codegen/Crm/Owners/Model/ForwardPaging.php +++ b/codegen/Crm/Owners/Model/ForwardPaging.php @@ -2,7 +2,7 @@ /** * ForwardPaging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -318,11 +318,11 @@ public function setNext($next) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -330,12 +330,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -360,11 +360,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Owners/Model/ModelInterface.php b/codegen/Crm/Owners/Model/ModelInterface.php index 9389c3e2..c880eaca 100644 --- a/codegen/Crm/Owners/Model/ModelInterface.php +++ b/codegen/Crm/Owners/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners\Model @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** diff --git a/codegen/Crm/Owners/Model/NextPage.php b/codegen/Crm/Owners/Model/NextPage.php index 5c8f000f..8a1a9baf 100644 --- a/codegen/Crm/Owners/Model/NextPage.php +++ b/codegen/Crm/Owners/Model/NextPage.php @@ -2,7 +2,7 @@ /** * NextPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * NextPage Class Doc Comment * * @category Class + * @description Specifies the paging information needed to retrieve the next set of results in a paginated API response * @package HubSpot\Client\Crm\Owners * @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 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 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/Crm/Owners/Model/PublicOwner.php b/codegen/Crm/Owners/Model/PublicOwner.php index 7d11d40e..0e0c375d 100644 --- a/codegen/Crm/Owners/Model/PublicOwner.php +++ b/codegen/Crm/Owners/Model/PublicOwner.php @@ -2,7 +2,7 @@ /** * PublicOwner * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,17 +57,17 @@ class PublicOwner implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'archived' => 'bool', + 'created_at' => '\DateTime', + 'email' => 'string', 'first_name' => 'string', + 'id' => 'string', 'last_name' => 'string', - 'created_at' => '\DateTime', - 'archived' => 'bool', 'teams' => '\HubSpot\Client\Crm\Owners\Model\PublicTeam[]', - 'id' => 'string', - 'user_id_including_inactive' => 'int', 'type' => 'string', + 'updated_at' => '\DateTime', 'user_id' => 'int', - 'email' => 'string', - 'updated_at' => '\DateTime' + 'user_id_including_inactive' => 'int' ]; /** @@ -78,17 +78,17 @@ class PublicOwner implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'archived' => null, + 'created_at' => 'date-time', + 'email' => null, 'first_name' => null, + 'id' => null, 'last_name' => null, - 'created_at' => 'date-time', - 'archived' => null, 'teams' => null, - 'id' => null, - 'user_id_including_inactive' => 'int32', 'type' => null, + 'updated_at' => 'date-time', 'user_id' => 'int32', - 'email' => null, - 'updated_at' => 'date-time' + 'user_id_including_inactive' => 'int32' ]; /** @@ -97,17 +97,17 @@ class PublicOwner implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'archived' => false, + 'created_at' => false, + 'email' => false, 'first_name' => false, + 'id' => false, 'last_name' => false, - 'created_at' => false, - 'archived' => false, 'teams' => false, - 'id' => false, - 'user_id_including_inactive' => false, 'type' => false, + 'updated_at' => false, 'user_id' => false, - 'email' => false, - 'updated_at' => false + 'user_id_including_inactive' => false ]; /** @@ -196,17 +196,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'archived' => 'archived', + 'created_at' => 'createdAt', + 'email' => 'email', 'first_name' => 'firstName', + 'id' => 'id', 'last_name' => 'lastName', - 'created_at' => 'createdAt', - 'archived' => 'archived', 'teams' => 'teams', - 'id' => 'id', - 'user_id_including_inactive' => 'userIdIncludingInactive', 'type' => 'type', + 'updated_at' => 'updatedAt', 'user_id' => 'userId', - 'email' => 'email', - 'updated_at' => 'updatedAt' + 'user_id_including_inactive' => 'userIdIncludingInactive' ]; /** @@ -215,17 +215,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'archived' => 'setArchived', + 'created_at' => 'setCreatedAt', + 'email' => 'setEmail', 'first_name' => 'setFirstName', + 'id' => 'setId', 'last_name' => 'setLastName', - 'created_at' => 'setCreatedAt', - 'archived' => 'setArchived', 'teams' => 'setTeams', - 'id' => 'setId', - 'user_id_including_inactive' => 'setUserIdIncludingInactive', 'type' => 'setType', + 'updated_at' => 'setUpdatedAt', 'user_id' => 'setUserId', - 'email' => 'setEmail', - 'updated_at' => 'setUpdatedAt' + 'user_id_including_inactive' => 'setUserIdIncludingInactive' ]; /** @@ -234,17 +234,17 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'archived' => 'getArchived', + 'created_at' => 'getCreatedAt', + 'email' => 'getEmail', 'first_name' => 'getFirstName', + 'id' => 'getId', 'last_name' => 'getLastName', - 'created_at' => 'getCreatedAt', - 'archived' => 'getArchived', 'teams' => 'getTeams', - 'id' => 'getId', - 'user_id_including_inactive' => 'getUserIdIncludingInactive', 'type' => 'getType', + 'updated_at' => 'getUpdatedAt', 'user_id' => 'getUserId', - 'email' => 'getEmail', - 'updated_at' => 'getUpdatedAt' + 'user_id_including_inactive' => 'getUserIdIncludingInactive' ]; /** @@ -319,17 +319,17 @@ public function getTypeAllowableValues() */ public function __construct(?array $data = null) { + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); $this->setIfExists('last_name', $data ?? [], null); - $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('teams', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('user_id_including_inactive', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('user_id', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('user_id', $data ?? [], null); + $this->setIfExists('user_id_including_inactive', $data ?? [], null); } /** @@ -359,12 +359,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['created_at'] === null) { - $invalidProperties[] = "'created_at' can't be null"; - } if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } @@ -399,55 +399,28 @@ public function valid() /** - * Gets first_name - * - * @return string|null - */ - public function getFirstName() - { - return $this->container['first_name']; - } - - /** - * Sets first_name - * - * @param string|null $first_name first_name - * - * @return self - */ - public function setFirstName($first_name) - { - if (is_null($first_name)) { - throw new \InvalidArgumentException('non-nullable first_name cannot be null'); - } - $this->container['first_name'] = $first_name; - - return $this; - } - - /** - * Gets last_name + * Gets archived * - * @return string|null + * @return bool */ - public function getLastName() + public function getArchived() { - return $this->container['last_name']; + return $this->container['archived']; } /** - * Sets last_name + * Sets archived * - * @param string|null $last_name last_name + * @param bool $archived Indicates whether the owner is archived. * * @return self */ - public function setLastName($last_name) + public function setArchived($archived) { - if (is_null($last_name)) { - throw new \InvalidArgumentException('non-nullable last_name cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['last_name'] = $last_name; + $this->container['archived'] = $archived; return $this; } @@ -465,7 +438,7 @@ public function getCreatedAt() /** * Sets created_at * - * @param \DateTime $created_at created_at + * @param \DateTime $created_at The date and time when the owner was created. * * @return self */ @@ -480,55 +453,55 @@ public function setCreatedAt($created_at) } /** - * Gets archived + * Gets email * - * @return bool + * @return string|null */ - public function getArchived() + public function getEmail() { - return $this->container['archived']; + return $this->container['email']; } /** - * Sets archived + * Sets email * - * @param bool $archived archived + * @param string|null $email The email address of the owner. * * @return self */ - public function setArchived($archived) + public function setEmail($email) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); } - $this->container['archived'] = $archived; + $this->container['email'] = $email; return $this; } /** - * Gets teams + * Gets first_name * - * @return \HubSpot\Client\Crm\Owners\Model\PublicTeam[]|null + * @return string|null */ - public function getTeams() + public function getFirstName() { - return $this->container['teams']; + return $this->container['first_name']; } /** - * Sets teams + * Sets first_name * - * @param \HubSpot\Client\Crm\Owners\Model\PublicTeam[]|null $teams teams + * @param string|null $first_name The first name of the owner. * * @return self */ - public function setTeams($teams) + public function setFirstName($first_name) { - if (is_null($teams)) { - throw new \InvalidArgumentException('non-nullable teams cannot be null'); + if (is_null($first_name)) { + throw new \InvalidArgumentException('non-nullable first_name cannot be null'); } - $this->container['teams'] = $teams; + $this->container['first_name'] = $first_name; return $this; } @@ -546,7 +519,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The unique identifier of the owner. * * @return self */ @@ -561,28 +534,55 @@ public function setId($id) } /** - * Gets user_id_including_inactive + * Gets last_name * - * @return int|null + * @return string|null */ - public function getUserIdIncludingInactive() + public function getLastName() { - return $this->container['user_id_including_inactive']; + return $this->container['last_name']; } /** - * Sets user_id_including_inactive + * Sets last_name * - * @param int|null $user_id_including_inactive user_id_including_inactive + * @param string|null $last_name The last name of the owner. * * @return self */ - public function setUserIdIncludingInactive($user_id_including_inactive) + public function setLastName($last_name) { - if (is_null($user_id_including_inactive)) { - throw new \InvalidArgumentException('non-nullable user_id_including_inactive cannot be null'); + if (is_null($last_name)) { + throw new \InvalidArgumentException('non-nullable last_name cannot be null'); } - $this->container['user_id_including_inactive'] = $user_id_including_inactive; + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets teams + * + * @return \HubSpot\Client\Crm\Owners\Model\PublicTeam[]|null + */ + public function getTeams() + { + return $this->container['teams']; + } + + /** + * Sets teams + * + * @param \HubSpot\Client\Crm\Owners\Model\PublicTeam[]|null $teams teams + * + * @return self + */ + public function setTeams($teams) + { + if (is_null($teams)) { + throw new \InvalidArgumentException('non-nullable teams cannot be null'); + } + $this->container['teams'] = $teams; return $this; } @@ -600,7 +600,7 @@ public function getType() /** * Sets type * - * @param string $type type + * @param string $type The type of the owner, which can be either PERSON or QUEUE. * * @return self */ @@ -625,93 +625,93 @@ public function setType($type) } /** - * Gets user_id + * Gets updated_at * - * @return int|null + * @return \DateTime */ - public function getUserId() + public function getUpdatedAt() { - return $this->container['user_id']; + return $this->container['updated_at']; } /** - * Sets user_id + * Sets updated_at * - * @param int|null $user_id user_id + * @param \DateTime $updated_at The date and time when the owner was last updated. * * @return self */ - public function setUserId($user_id) + public function setUpdatedAt($updated_at) { - if (is_null($user_id)) { - throw new \InvalidArgumentException('non-nullable user_id cannot be null'); + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); } - $this->container['user_id'] = $user_id; + $this->container['updated_at'] = $updated_at; return $this; } /** - * Gets email + * Gets user_id * - * @return string|null + * @return int|null */ - public function getEmail() + public function getUserId() { - return $this->container['email']; + return $this->container['user_id']; } /** - * Sets email + * Sets user_id * - * @param string|null $email email + * @param int|null $user_id The user ID of the owner. * * @return self */ - public function setEmail($email) + public function setUserId($user_id) { - if (is_null($email)) { - throw new \InvalidArgumentException('non-nullable email cannot be null'); + if (is_null($user_id)) { + throw new \InvalidArgumentException('non-nullable user_id cannot be null'); } - $this->container['email'] = $email; + $this->container['user_id'] = $user_id; return $this; } /** - * Gets updated_at + * Gets user_id_including_inactive * - * @return \DateTime + * @return int|null */ - public function getUpdatedAt() + public function getUserIdIncludingInactive() { - return $this->container['updated_at']; + return $this->container['user_id_including_inactive']; } /** - * Sets updated_at + * Sets user_id_including_inactive * - * @param \DateTime $updated_at updated_at + * @param int|null $user_id_including_inactive The user ID of the owner, including inactive users. * * @return self */ - public function setUpdatedAt($updated_at) + public function setUserIdIncludingInactive($user_id_including_inactive) { - if (is_null($updated_at)) { - throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + if (is_null($user_id_including_inactive)) { + throw new \InvalidArgumentException('non-nullable user_id_including_inactive cannot be null'); } - $this->container['updated_at'] = $updated_at; + $this->container['user_id_including_inactive'] = $user_id_including_inactive; 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]); } @@ -719,12 +719,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; } @@ -749,11 +749,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Owners/Model/PublicTeam.php b/codegen/Crm/Owners/Model/PublicTeam.php index b960a9bf..649b3b60 100644 --- a/codegen/Crm/Owners/Model/PublicTeam.php +++ b/codegen/Crm/Owners/Model/PublicTeam.php @@ -2,7 +2,7 @@ /** * PublicTeam * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,8 +57,8 @@ class PublicTeam implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'name' => 'string', 'id' => 'string', + 'name' => 'string', 'primary' => 'bool' ]; @@ -70,8 +70,8 @@ class PublicTeam implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'name' => null, 'id' => null, + 'name' => null, 'primary' => null ]; @@ -81,8 +81,8 @@ class PublicTeam implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'name' => false, 'id' => false, + 'name' => false, 'primary' => false ]; @@ -172,8 +172,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'name' => 'name', 'id' => 'id', + 'name' => 'name', 'primary' => 'primary' ]; @@ -183,8 +183,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'name' => 'setName', 'id' => 'setId', + 'name' => 'setName', 'primary' => 'setPrimary' ]; @@ -194,8 +194,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'name' => 'getName', 'id' => 'getId', + 'name' => 'getName', 'primary' => 'getPrimary' ]; @@ -256,8 +256,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); $this->setIfExists('primary', $data ?? [], null); } @@ -288,12 +288,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } if ($this->container['primary'] === null) { $invalidProperties[] = "'primary' can't be null"; } @@ -313,55 +313,55 @@ public function valid() /** - * Gets name + * Gets id * * @return string */ - public function getName() + public function getId() { - return $this->container['name']; + return $this->container['id']; } /** - * Sets name + * Sets id * - * @param string $name name + * @param string $id id * * @return self */ - public function setName($name) + public function setId($id) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['name'] = $name; + $this->container['id'] = $id; return $this; } /** - * Gets id + * Gets name * * @return string */ - public function getId() + public function getName() { - return $this->container['id']; + return $this->container['name']; } /** - * Sets id + * Sets name * - * @param string $id id + * @param string $name name * * @return self */ - public function setId($id) + public function setName($name) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['id'] = $id; + $this->container['name'] = $name; return $this; } @@ -395,11 +395,11 @@ public function setPrimary($primary) /** * 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]); } @@ -407,12 +407,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; } @@ -437,11 +437,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Crm/Owners/ObjectSerializer.php b/codegen/Crm/Owners/ObjectSerializer.php index b4b0e34f..563309f5 100644 --- a/codegen/Crm/Owners/ObjectSerializer.php +++ b/codegen/Crm/Owners/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Crm\Owners @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -323,24 +323,6 @@ public static function toHeaderValue($value) return self::toString($value); } - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -612,6 +594,6 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } } - return $qs ? (string) substr($qs, 0, -1) : ''; + return $qs ? substr($qs, 0, -1) : ''; } }