diff --git a/CHANGELOG.md b/CHANGELOG.md index bc632c1e..d5bce3bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/14.0.5...HEAD) +## [Unreleased](https://github.com/HubSpot/hubspot-api-php/compare/14.0.6...HEAD) + +## [14.0.6](https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.6) - 2026-04-22 + +### CRM Objects + +- `crm()->objects()->basicApi()->create()` now returns HTTP 201 instead of 200. +- `crm()->objects()->basicApi()->getPage()` return type changed from `CollectionResponseSimplePublicObjectWithAssociations` to `CollectionResponseSimplePublicObjectWithAssociationsForwardPaging`. +- `crm()->objects()->batchApi()->create()` now returns HTTP 201 instead of 200, and handles HTTP 207 (partial success) responses with new `BatchResponseSimplePublicObjectWithErrors` model. +- `crm()->objects()->batchApi()->read()` and `update()` now handle HTTP 207 (partial success) responses, returning `BatchResponseSimplePublicObjectWithErrors`. +- `crm()->objects()->batchApi()->upsert()` now handles HTTP 207 (partial success) responses, returning `BatchResponseSimplePublicUpsertObjectWithErrors`. +- `HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject` no longer includes `errors` and `numErrors` fields — those are available on the new `BatchResponseSimplePublicObjectWithErrors` model. +- `HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject` no longer includes `errors` and `numErrors` fields — those are available on the new `BatchResponseSimplePublicUpsertObjectWithErrors` model. +- Renamed model `CollectionResponseSimplePublicObjectWithAssociations` to `CollectionResponseSimplePublicObjectWithAssociationsForwardPaging`. +- Added new models: `BatchResponseSimplePublicObjectWithErrors`, `BatchResponseSimplePublicUpsertObjectWithErrors`, `ForwardPaging`. ## [14.0.5](https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.5) - 2026-04-02 @@ -1230,7 +1244,7 @@ to 25. getSubscriptions => getAll (webhooks()->subscriptionsApi()) 26. updateSubscription => update (webhooks()->subscriptionsApi()) -[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/14.0.5...HEAD +[Unreleased]: https://github.com/HubSpot/hubspot-api-php/compare/14.0.6...HEAD [1.0.0-beta]: https://github.com/HubSpot/hubspot-api-php/releases/tag/v1.0.0-beta [1.1.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.1.0 [1.2.0]: https://github.com/HubSpot/hubspot-api-php/releases/tag/1.2.0 @@ -1302,3 +1316,4 @@ to [14.0.3]: https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.3 [14.0.4]: https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.4 [14.0.5]: https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.5 +[14.0.6]: https://github.com/HubSpot/hubspot-api-php/releases/tag/14.0.6 diff --git a/codegen/Crm/Objects/Api/BasicApi.php b/codegen/Crm/Objects/Api/BasicApi.php index a194108b..fb2e22d5 100644 --- a/codegen/Crm/Objects/Api/BasicApi.php +++ b/codegen/Crm/Objects/Api/BasicApi.php @@ -142,8 +142,8 @@ public function getConfig() * * Archive * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format @@ -160,8 +160,8 @@ public function archive($object_type, $object_id, string $contentType = self::co * * Archive * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format @@ -207,7 +207,7 @@ public function archiveWithHttpInfo($object_type, $object_id, string $contentTyp $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -218,8 +218,8 @@ public function archiveWithHttpInfo($object_type, $object_id, string $contentTyp * * Archive * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -240,8 +240,8 @@ function ($response) { * * Archive * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -278,8 +278,8 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -392,7 +392,7 @@ public function archiveRequest($object_type, $object_id, string $contentType = s * * Create * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -411,7 +411,7 @@ public function create($object_type, $simple_public_object_input_for_create, str * * Create * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -461,7 +461,7 @@ public function createWithHttpInfo($object_type, $simple_public_object_input_for ); } - + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( @@ -483,7 +483,7 @@ public function createWithHttpInfo($object_type, $simple_public_object_input_for ); } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject', @@ -500,7 +500,7 @@ public function createWithHttpInfo($object_type, $simple_public_object_input_for $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -511,7 +511,7 @@ public function createWithHttpInfo($object_type, $simple_public_object_input_for * * Create * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -533,7 +533,7 @@ function ($response) { * * Create * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -584,7 +584,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate $simple_public_object_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -697,13 +697,13 @@ public function createRequest($object_type, $simple_public_object_input_for_crea * * Read * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format @@ -721,13 +721,13 @@ public function getById($object_type, $object_id, $properties = null, $propertie * * Read * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format @@ -776,7 +776,7 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null ); } - + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( @@ -815,7 +815,7 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -826,13 +826,13 @@ public function getByIdWithHttpInfo($object_type, $object_id, $properties = null * * Read * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -853,13 +853,13 @@ function ($response) { * * Read * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -909,13 +909,13 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_type (required) + * @param string $object_id (required) * @param string[]|null $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) * @param string[]|null $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) * @param bool|null $archived Whether to return only results that have been archived. (optional, default to false) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1078,7 +1078,7 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr * * List * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) @@ -1089,7 +1089,7 @@ public function getByIdRequest($object_type, $object_id, $properties = null, $pr * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Model\Error */ public function getPage($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { @@ -1102,7 +1102,7 @@ public function getPage($object_type, $limit = 10, $after = null, $properties = * * List * - * @param string $object_type (required) + * @param string $object_type (required) * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) @@ -1113,7 +1113,7 @@ public function getPage($object_type, $limit = 10, $after = null, $properties = * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { @@ -1145,7 +1145,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p switch($statusCode) { case 200: return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', $request, $response, ); @@ -1157,7 +1157,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p ); } - + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( @@ -1173,7 +1173,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p } return $this->handleResponseWithDataType( - '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', $request, $response, ); @@ -1182,7 +1182,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations', + '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1196,7 +1196,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -1207,7 +1207,7 @@ public function getPageWithHttpInfo($object_type, $limit = 10, $after = null, $p * * List * - * @param string $object_type (required) + * @param string $object_type (required) * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) @@ -1234,7 +1234,7 @@ function ($response) { * * List * - * @param string $object_type (required) + * @param string $object_type (required) * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) @@ -1248,7 +1248,7 @@ function ($response) { */ public function getPageAsyncWithHttpInfo($object_type, $limit = 10, $after = null, $properties = null, $properties_with_history = null, $associations = null, $archived = false, string $contentType = self::contentTypes['getPage'][0]) { - $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociations'; + $returnType = '\HubSpot\Client\Crm\Objects\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; $request = $this->getPageRequest($object_type, $limit, $after, $properties, $properties_with_history, $associations, $archived, $contentType); return $this->client @@ -1290,7 +1290,7 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param string $object_type (required) + * @param string $object_type (required) * @param int|null $limit The maximum number of results to display per page. (optional, default to 10) * @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 $properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. (optional) @@ -1454,19 +1454,19 @@ public function getPageRequest($object_type, $limit = 10, $after = null, $proper * * Update * - * @param string $object_type object_type (required) - * @param string $object_id object_id (required) + * @param string $object_id (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error */ - public function update($object_type, $object_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function update($object_id, $object_type, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - list($response) = $this->updateWithHttpInfo($object_type, $object_id, $simple_public_object_input, $id_property, $contentType); + list($response) = $this->updateWithHttpInfo($object_id, $object_type, $simple_public_object_input, $id_property, $contentType); return $response; } @@ -1475,19 +1475,19 @@ public function update($object_type, $object_id, $simple_public_object_input, $i * * Update * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_id (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Objects\Model\SimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($object_type, $object_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function updateWithHttpInfo($object_id, $object_type, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - $request = $this->updateRequest($object_type, $object_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->updateRequest($object_id, $object_type, $simple_public_object_input, $id_property, $contentType); try { $options = $this->createHttpClientOption(); @@ -1527,7 +1527,7 @@ public function updateWithHttpInfo($object_type, $object_id, $simple_public_obje ); } - + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( @@ -1566,7 +1566,7 @@ public function updateWithHttpInfo($object_type, $object_id, $simple_public_obje $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -1577,18 +1577,18 @@ public function updateWithHttpInfo($object_type, $object_id, $simple_public_obje * * Update * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_id (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsync($object_type, $object_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function updateAsync($object_id, $object_type, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - return $this->updateAsyncWithHttpInfo($object_type, $object_id, $simple_public_object_input, $id_property, $contentType) + return $this->updateAsyncWithHttpInfo($object_id, $object_type, $simple_public_object_input, $id_property, $contentType) ->then( function ($response) { return $response[0]; @@ -1601,19 +1601,19 @@ function ($response) { * * Update * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_id (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAsyncWithHttpInfo($object_type, $object_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function updateAsyncWithHttpInfo($object_id, $object_type, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { $returnType = '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject'; - $request = $this->updateRequest($object_type, $object_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->updateRequest($object_id, $object_type, $simple_public_object_input, $id_property, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1654,29 +1654,29 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $object_type (required) - * @param string $object_id (required) + * @param string $object_id (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string|null $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object type (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateRequest($object_type, $object_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function updateRequest($object_id, $object_type, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) { - // verify the required parameter 'object_type' is set - if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { + // verify the required parameter 'object_id' is set + if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_type when calling update' + 'Missing the required parameter $object_id when calling update' ); } - // verify the required parameter 'object_id' is set - if ($object_id === null || (is_array($object_id) && count($object_id) === 0)) { + // verify the required parameter 'object_type' is set + if ($object_type === null || (is_array($object_type) && count($object_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $object_id when calling update' + 'Missing the required parameter $object_type when calling update' ); } @@ -1708,18 +1708,18 @@ public function updateRequest($object_type, $object_id, $simple_public_object_in // path params - if ($object_type !== null) { + if ($object_id !== null) { $resourcePath = str_replace( - '{' . 'objectType' . '}', - ObjectSerializer::toPathValue($object_type), + '{' . 'objectId' . '}', + ObjectSerializer::toPathValue($object_id), $resourcePath ); } // path params - if ($object_id !== null) { + if ($object_type !== null) { $resourcePath = str_replace( - '{' . 'objectId' . '}', - ObjectSerializer::toPathValue($object_id), + '{' . 'objectType' . '}', + ObjectSerializer::toPathValue($object_type), $resourcePath ); } diff --git a/codegen/Crm/Objects/Api/BatchApi.php b/codegen/Crm/Objects/Api/BatchApi.php index aae5af27..2102d50b 100644 --- a/codegen/Crm/Objects/Api/BatchApi.php +++ b/codegen/Crm/Objects/Api/BatchApi.php @@ -142,7 +142,7 @@ public function getConfig() * * Archive a batch of objects by ID * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -160,7 +160,7 @@ public function archive($object_type, $batch_input_simple_public_object_id, stri * * Archive a batch of objects by ID * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -218,7 +218,7 @@ public function archiveWithHttpInfo($object_type, $batch_input_simple_public_obj * * Archive a batch of objects by ID * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -240,7 +240,7 @@ function ($response) { * * Archive a batch of objects by ID * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -278,7 +278,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectId $batch_input_simple_public_object_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation * @@ -391,13 +391,13 @@ public function archiveRequest($object_type, $batch_input_simple_public_object_i * * Create a batch of objects * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ public function create($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { @@ -410,13 +410,13 @@ public function create($object_type, $batch_input_simple_public_object_batch_inp * * Create a batch of objects * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function createWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { @@ -446,12 +446,18 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje switch($statusCode) { - case 200: + case 201: return $this->handleResponseWithDataType( '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', $request, $response, ); + case 207: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $request, + $response, + ); default: return $this->handleResponseWithDataType( '\HubSpot\Client\Crm\Objects\Model\Error', @@ -482,7 +488,7 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje ); } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject', @@ -490,6 +496,14 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje ); $e->setResponseObject($data); throw $e; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -510,7 +524,7 @@ public function createWithHttpInfo($object_type, $batch_input_simple_public_obje * * Create a batch of objects * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -532,7 +546,7 @@ function ($response) { * * Create a batch of objects * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -583,7 +597,7 @@ function ($exception) { /** * Create request for operation 'create' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputForCreate $batch_input_simple_public_object_batch_input_for_create (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * @@ -696,14 +710,14 @@ public function createRequest($object_type, $batch_input_simple_public_object_ba * * Read a batch of objects by internal ID, or unique property values * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) * @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['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ public function read($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { @@ -716,14 +730,14 @@ public function read($object_type, $batch_read_input_simple_public_object_id, $a * * Read a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @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['read'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_object_id, $archived = false, string $contentType = self::contentTypes['read'][0]) { @@ -759,6 +773,12 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o $request, $response, ); + case 207: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $request, + $response, + ); default: return $this->handleResponseWithDataType( '\HubSpot\Client\Crm\Objects\Model\Error', @@ -797,6 +817,14 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o ); $e->setResponseObject($data); throw $e; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -817,7 +845,7 @@ public function readWithHttpInfo($object_type, $batch_read_input_simple_public_o * * Read a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @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['read'] to see the possible values for this operation @@ -840,7 +868,7 @@ function ($response) { * * Read a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @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['read'] to see the possible values for this operation @@ -892,7 +920,7 @@ function ($exception) { /** * Create request for operation 'read' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) * @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['read'] to see the possible values for this operation @@ -1016,13 +1044,13 @@ public function readRequest($object_type, $batch_read_input_simple_public_object * * Update a batch of objects by internal ID, or unique property values * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ public function update($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { @@ -1035,13 +1063,13 @@ public function update($object_type, $batch_input_simple_public_object_batch_inp * * Update a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function updateWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input, string $contentType = self::contentTypes['update'][0]) { @@ -1077,6 +1105,12 @@ public function updateWithHttpInfo($object_type, $batch_input_simple_public_obje $request, $response, ); + case 207: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $request, + $response, + ); default: return $this->handleResponseWithDataType( '\HubSpot\Client\Crm\Objects\Model\Error', @@ -1115,6 +1149,14 @@ public function updateWithHttpInfo($object_type, $batch_input_simple_public_obje ); $e->setResponseObject($data); throw $e; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1135,7 +1177,7 @@ public function updateWithHttpInfo($object_type, $batch_input_simple_public_obje * * Update a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1157,7 +1199,7 @@ function ($response) { * * Update a batch of objects by internal ID, or unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1208,7 +1250,7 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInput $batch_input_simple_public_object_batch_input (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation * @@ -1321,13 +1363,13 @@ public function updateRequest($object_type, $batch_input_simple_public_object_ba * * Create or update a batch of objects by unique property values * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\Error + * @return \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error */ public function upsert($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) { @@ -1340,13 +1382,13 @@ public function upsert($object_type, $batch_input_simple_public_object_batch_inp * * Create or update a batch of objects by unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Objects\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @return array of \HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObject|\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors|\HubSpot\Client\Crm\Objects\Model\Error, HTTP status code, HTTP response headers (array of strings) */ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_object_batch_input_upsert, string $contentType = self::contentTypes['upsert'][0]) { @@ -1382,6 +1424,12 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje $request, $response, ); + case 207: + return $this->handleResponseWithDataType( + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $request, + $response, + ); default: return $this->handleResponseWithDataType( '\HubSpot\Client\Crm\Objects\Model\Error', @@ -1420,6 +1468,14 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje ); $e->setResponseObject($data); throw $e; + case 207: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Objects\Model\BatchResponseSimplePublicUpsertObjectWithErrors', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1440,7 +1496,7 @@ public function upsertWithHttpInfo($object_type, $batch_input_simple_public_obje * * Create or update a batch of objects by unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -1462,7 +1518,7 @@ function ($response) { * * Create or update a batch of objects by unique property values * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * @@ -1513,7 +1569,7 @@ function ($exception) { /** * Create request for operation 'upsert' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\BatchInputSimplePublicObjectBatchInputUpsert $batch_input_simple_public_object_batch_input_upsert (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upsert'] to see the possible values for this operation * diff --git a/codegen/Crm/Objects/Api/SearchApi.php b/codegen/Crm/Objects/Api/SearchApi.php index 63c9b495..a0fd758f 100644 --- a/codegen/Crm/Objects/Api/SearchApi.php +++ b/codegen/Crm/Objects/Api/SearchApi.php @@ -128,7 +128,7 @@ public function getConfig() /** * Operation doSearch * - * @param string $object_type object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request public_object_search_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * @@ -145,7 +145,7 @@ public function doSearch($object_type, $public_object_search_request, string $co /** * Operation doSearchWithHttpInfo * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * @@ -243,7 +243,7 @@ public function doSearchWithHttpInfo($object_type, $public_object_search_request /** * Operation doSearchAsync * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * @@ -263,7 +263,7 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * @@ -314,7 +314,7 @@ function ($exception) { /** * Create request for operation 'doSearch' * - * @param string $object_type (required) + * @param string $object_type (required) * @param \HubSpot\Client\Crm\Objects\Model\PublicObjectSearchRequest $public_object_search_request (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php index b8381b9c..c4e8b344 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObject.php @@ -59,9 +59,7 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J */ protected static $openAPITypes = [ 'completed_at' => '\DateTime', - 'errors' => '\HubSpot\Client\Crm\Objects\Model\StandardError[]', 'links' => 'array', - 'num_errors' => 'int', 'requested_at' => '\DateTime', 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject[]', 'started_at' => '\DateTime', @@ -77,9 +75,7 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J */ protected static $openAPIFormats = [ 'completed_at' => 'date-time', - 'errors' => null, 'links' => null, - 'num_errors' => 'int32', 'requested_at' => 'date-time', 'results' => null, 'started_at' => 'date-time', @@ -93,9 +89,7 @@ class BatchResponseSimplePublicObject implements ModelInterface, ArrayAccess, \J */ protected static array $openAPINullables = [ 'completed_at' => false, - 'errors' => false, 'links' => false, - 'num_errors' => false, 'requested_at' => false, 'results' => false, 'started_at' => false, @@ -189,9 +183,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'completed_at' => 'completedAt', - 'errors' => 'errors', 'links' => 'links', - 'num_errors' => 'numErrors', 'requested_at' => 'requestedAt', 'results' => 'results', 'started_at' => 'startedAt', @@ -205,9 +197,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'completed_at' => 'setCompletedAt', - 'errors' => 'setErrors', 'links' => 'setLinks', - 'num_errors' => 'setNumErrors', 'requested_at' => 'setRequestedAt', 'results' => 'setResults', 'started_at' => 'setStartedAt', @@ -221,9 +211,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'completed_at' => 'getCompletedAt', - 'errors' => 'getErrors', 'links' => 'getLinks', - 'num_errors' => 'getNumErrors', 'requested_at' => 'getRequestedAt', 'results' => 'getResults', 'started_at' => 'getStartedAt', @@ -307,9 +295,7 @@ public function getStatusAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('num_errors', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); $this->setIfExists('started_at', $data ?? [], null); @@ -406,33 +392,6 @@ public function setCompletedAt($completed_at) return $this; } - /** - * Gets errors - * - * @return \HubSpot\Client\Crm\Objects\Model\StandardError[]|null - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \HubSpot\Client\Crm\Objects\Model\StandardError[]|null $errors errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** * Gets links * @@ -460,33 +419,6 @@ public function setLinks($links) return $this; } - /** - * Gets num_errors - * - * @return int|null - */ - public function getNumErrors() - { - return $this->container['num_errors']; - } - - /** - * Sets num_errors - * - * @param int|null $num_errors The total number of errors that occurred during the batch operation. - * - * @return self - */ - public function setNumErrors($num_errors) - { - if (is_null($num_errors)) { - throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); - } - $this->container['num_errors'] = $num_errors; - - return $this; - } - /** * Gets requested_at * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php new file mode 100644 index 00000000..378350a7 --- /dev/null +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -0,0 +1,698 @@ + + */ +class BatchResponseSimplePublicObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'errors' => '\HubSpot\Client\Crm\Objects\Model\StandardError[]', + 'links' => 'array', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObject[]', + 'started_at' => '\DateTime', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'errors' => null, + 'links' => null, + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'results' => null, + 'started_at' => 'date-time', + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'errors' => false, + 'links' => false, + 'num_errors' => false, + 'requested_at' => false, + 'results' => false, + 'started_at' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'errors' => 'errors', + 'links' => 'links', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'results' => 'results', + 'started_at' => 'startedAt', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'errors' => 'setErrors', + 'links' => 'setLinks', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'results' => 'setResults', + 'started_at' => 'setStartedAt', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'errors' => 'getErrors', + 'links' => 'getLinks', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'results' => 'getResults', + 'started_at' => 'getStartedAt', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at The timestamp when the batch process was completed, in ISO 8601 format. + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links An object containing relevant links related to the batch request. + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors The number of errors encountered during the batch process. + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at The timestamp when the batch process was initiated, in ISO 8601 format. + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at The timestamp when the batch process began execution, in ISO 8601 format. + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status The status of the batch processing request - \"PENDING\", \"PROCESSING\", \"CANCELLED\", or \"COMPLETE\" + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php index f5e6a0b6..5313fe91 100644 --- a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObject.php @@ -59,9 +59,7 @@ class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAcce */ protected static $openAPITypes = [ 'completed_at' => '\DateTime', - 'errors' => '\HubSpot\Client\Crm\Objects\Model\StandardError[]', 'links' => 'array', - 'num_errors' => 'int', 'requested_at' => '\DateTime', 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[]', 'started_at' => '\DateTime', @@ -77,9 +75,7 @@ class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAcce */ protected static $openAPIFormats = [ 'completed_at' => 'date-time', - 'errors' => null, 'links' => null, - 'num_errors' => 'int32', 'requested_at' => 'date-time', 'results' => null, 'started_at' => 'date-time', @@ -93,9 +89,7 @@ class BatchResponseSimplePublicUpsertObject implements ModelInterface, ArrayAcce */ protected static array $openAPINullables = [ 'completed_at' => false, - 'errors' => false, 'links' => false, - 'num_errors' => false, 'requested_at' => false, 'results' => false, 'started_at' => false, @@ -189,9 +183,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'completed_at' => 'completedAt', - 'errors' => 'errors', 'links' => 'links', - 'num_errors' => 'numErrors', 'requested_at' => 'requestedAt', 'results' => 'results', 'started_at' => 'startedAt', @@ -205,9 +197,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'completed_at' => 'setCompletedAt', - 'errors' => 'setErrors', 'links' => 'setLinks', - 'num_errors' => 'setNumErrors', 'requested_at' => 'setRequestedAt', 'results' => 'setResults', 'started_at' => 'setStartedAt', @@ -221,9 +211,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'completed_at' => 'getCompletedAt', - 'errors' => 'getErrors', 'links' => 'getLinks', - 'num_errors' => 'getNumErrors', 'requested_at' => 'getRequestedAt', 'results' => 'getResults', 'started_at' => 'getStartedAt', @@ -307,9 +295,7 @@ public function getStatusAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('num_errors', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); $this->setIfExists('started_at', $data ?? [], null); @@ -406,33 +392,6 @@ public function setCompletedAt($completed_at) return $this; } - /** - * Gets errors - * - * @return \HubSpot\Client\Crm\Objects\Model\StandardError[]|null - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \HubSpot\Client\Crm\Objects\Model\StandardError[]|null $errors errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** * Gets links * @@ -460,33 +419,6 @@ public function setLinks($links) return $this; } - /** - * Gets num_errors - * - * @return int|null - */ - public function getNumErrors() - { - return $this->container['num_errors']; - } - - /** - * Sets num_errors - * - * @param int|null $num_errors The total number of errors that occurred during the operation. - * - * @return self - */ - public function setNumErrors($num_errors) - { - if (is_null($num_errors)) { - throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); - } - $this->container['num_errors'] = $num_errors; - - return $this; - } - /** * Gets requested_at * diff --git a/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php new file mode 100644 index 00000000..2a13d6f6 --- /dev/null +++ b/codegen/Crm/Objects/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -0,0 +1,698 @@ + + */ +class BatchResponseSimplePublicUpsertObjectWithErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BatchResponseSimplePublicUpsertObjectWithErrors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed_at' => '\DateTime', + 'errors' => '\HubSpot\Client\Crm\Objects\Model\StandardError[]', + 'links' => 'array', + 'num_errors' => 'int', + 'requested_at' => '\DateTime', + 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[]', + 'started_at' => '\DateTime', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed_at' => 'date-time', + 'errors' => null, + 'links' => null, + 'num_errors' => 'int32', + 'requested_at' => 'date-time', + 'results' => null, + 'started_at' => 'date-time', + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'completed_at' => false, + 'errors' => false, + 'links' => false, + 'num_errors' => false, + 'requested_at' => false, + 'results' => false, + 'started_at' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed_at' => 'completedAt', + 'errors' => 'errors', + 'links' => 'links', + 'num_errors' => 'numErrors', + 'requested_at' => 'requestedAt', + 'results' => 'results', + 'started_at' => 'startedAt', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed_at' => 'setCompletedAt', + 'errors' => 'setErrors', + 'links' => 'setLinks', + 'num_errors' => 'setNumErrors', + 'requested_at' => 'setRequestedAt', + 'results' => 'setResults', + 'started_at' => 'setStartedAt', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed_at' => 'getCompletedAt', + 'errors' => 'getErrors', + 'links' => 'getLinks', + 'num_errors' => 'getNumErrors', + 'requested_at' => 'getRequestedAt', + 'results' => 'getResults', + 'started_at' => 'getStartedAt', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_CANCELED = 'CANCELED'; + public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_CANCELED, + self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('num_errors', $data ?? [], null); + $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + $this->setIfExists('started_at', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['completed_at'] === null) { + $invalidProperties[] = "'completed_at' can't be null"; + } + if ($this->container['results'] === null) { + $invalidProperties[] = "'results' can't be null"; + } + if ($this->container['started_at'] === null) { + $invalidProperties[] = "'started_at' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets completed_at + * + * @return \DateTime + */ + public function getCompletedAt() + { + return $this->container['completed_at']; + } + + /** + * Sets completed_at + * + * @param \DateTime $completed_at The timestamp when the batch process was completed, in ISO 8601 format. + * + * @return self + */ + public function setCompletedAt($completed_at) + { + if (is_null($completed_at)) { + throw new \InvalidArgumentException('non-nullable completed_at cannot be null'); + } + $this->container['completed_at'] = $completed_at; + + return $this; + } + + /** + * Gets errors + * + * @return \HubSpot\Client\Crm\Objects\Model\StandardError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Crm\Objects\Model\StandardError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets links + * + * @return array|null + */ + public function getLinks() + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param array|null $links An object containing relevant links related to the batch request. + * + * @return self + */ + public function setLinks($links) + { + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets num_errors + * + * @return int|null + */ + public function getNumErrors() + { + return $this->container['num_errors']; + } + + /** + * Sets num_errors + * + * @param int|null $num_errors The number of errors encountered during the batch process. + * + * @return self + */ + public function setNumErrors($num_errors) + { + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + } + $this->container['num_errors'] = $num_errors; + + return $this; + } + + /** + * Gets requested_at + * + * @return \DateTime|null + */ + public function getRequestedAt() + { + return $this->container['requested_at']; + } + + /** + * Sets requested_at + * + * @param \DateTime|null $requested_at The timestamp when the batch process was initiated, in ISO 8601 format. + * + * @return self + */ + public function setRequestedAt($requested_at) + { + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + } + $this->container['requested_at'] = $requested_at; + + return $this; + } + + /** + * Gets results + * + * @return \HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[] + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \HubSpot\Client\Crm\Objects\Model\SimplePublicUpsertObject[] $results results + * + * @return self + */ + public function setResults($results) + { + if (is_null($results)) { + throw new \InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + + /** + * Gets started_at + * + * @return \DateTime + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param \DateTime $started_at The timestamp when the batch process began execution, in ISO 8601 format. + * + * @return self + */ + public function setStartedAt($started_at) + { + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + } + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status The status of the batch processing request. Can be: \"PENDING\", \"PROCESSING\", \"CANCELLED\", or \"COMPLETE\". + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php similarity index 95% rename from codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociations.php rename to codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index ff1c5930..2091e831 100644 --- a/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -1,6 +1,6 @@ */ -class CollectionResponseSimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, \JsonSerializable +class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * * @var string */ - protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociations'; + protected static $openAPIModelName = 'CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class CollectionResponseSimplePublicObjectWithAssociations implements ModelInter * @var string[] */ protected static $openAPITypes = [ - 'paging' => '\HubSpot\Client\Crm\Objects\Model\Paging', + 'paging' => '\HubSpot\Client\Crm\Objects\Model\ForwardPaging', 'results' => '\HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations[]' ]; @@ -302,7 +302,7 @@ public function valid() /** * Gets paging * - * @return \HubSpot\Client\Crm\Objects\Model\Paging|null + * @return \HubSpot\Client\Crm\Objects\Model\ForwardPaging|null */ public function getPaging() { @@ -312,7 +312,7 @@ public function getPaging() /** * Sets paging * - * @param \HubSpot\Client\Crm\Objects\Model\Paging|null $paging paging + * @param \HubSpot\Client\Crm\Objects\Model\ForwardPaging|null $paging paging * * @return self */ diff --git a/codegen/Crm/Objects/Model/ErrorDetail.php b/codegen/Crm/Objects/Model/ErrorDetail.php index 7cb97008..375fda6b 100644 --- a/codegen/Crm/Objects/Model/ErrorDetail.php +++ b/codegen/Crm/Objects/Model/ErrorDetail.php @@ -360,7 +360,7 @@ public function getContext() /** * Sets context * - * @param array|null $context The context for the error. + * @param array|null $context Context about the error condition * * @return self */ diff --git a/codegen/Crm/Objects/Model/ForwardPaging.php b/codegen/Crm/Objects/Model/ForwardPaging.php new file mode 100644 index 00000000..c27757b9 --- /dev/null +++ b/codegen/Crm/Objects/Model/ForwardPaging.php @@ -0,0 +1,409 @@ + + */ +class ForwardPaging implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ForwardPaging'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'next' => '\HubSpot\Client\Crm\Objects\Model\NextPage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'next' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'next' => 'next' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next' => 'setNext' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next' => 'getNext' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('next', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets next + * + * @return \HubSpot\Client\Crm\Objects\Model\NextPage|null + */ + public function getNext() + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param \HubSpot\Client\Crm\Objects\Model\NextPage|null $next next + * + * @return self + */ + public function setNext($next) + { + if (is_null($next)) { + throw new \InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer|string $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet(mixed $offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Objects/Model/SimplePublicObject.php b/codegen/Crm/Objects/Model/SimplePublicObject.php index 9f26ae7d..72d4b06a 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicObject.php @@ -331,9 +331,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['archived'] === null) { - $invalidProperties[] = "'archived' can't be null"; - } if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } @@ -364,7 +361,7 @@ public function valid() /** * Gets archived * - * @return bool + * @return bool|null */ public function getArchived() { @@ -374,7 +371,7 @@ public function getArchived() /** * Sets archived * - * @param bool $archived Whether the object is archived. + * @param bool|null $archived Whether the object is archived. * * @return self */ diff --git a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php index a3a081a4..b58bdd07 100644 --- a/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Objects/Model/SimplePublicObjectWithAssociations.php @@ -338,9 +338,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['archived'] === null) { - $invalidProperties[] = "'archived' can't be null"; - } if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } @@ -371,7 +368,7 @@ public function valid() /** * Gets archived * - * @return bool + * @return bool|null */ public function getArchived() { @@ -381,7 +378,7 @@ public function getArchived() /** * Sets archived * - * @param bool $archived Whether the object is archived. + * @param bool|null $archived Whether the object is archived. * * @return self */ diff --git a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php index 946e469c..6729f7ac 100644 --- a/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Objects/Model/SimplePublicUpsertObject.php @@ -338,9 +338,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['archived'] === null) { - $invalidProperties[] = "'archived' can't be null"; - } if ($this->container['created_at'] === null) { $invalidProperties[] = "'created_at' can't be null"; } @@ -374,7 +371,7 @@ public function valid() /** * Gets archived * - * @return bool + * @return bool|null */ public function getArchived() { @@ -384,7 +381,7 @@ public function getArchived() /** * Sets archived * - * @param bool $archived Whether the object is archived. + * @param bool|null $archived Whether the object is archived. * * @return self */ diff --git a/codegen/Crm/Objects/Model/StandardError.php b/codegen/Crm/Objects/Model/StandardError.php index edc48e1b..e25639bf 100644 --- a/codegen/Crm/Objects/Model/StandardError.php +++ b/codegen/Crm/Objects/Model/StandardError.php @@ -35,7 +35,7 @@ * StandardError Class Doc Comment * * @category Class - * @description Ye olde error + * @description Represents a standard error response in the HubSpot API, providing detailed information about an error that occurred during an API request. * @package HubSpot\Client\Crm\Objects * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/composer.json b/composer.json index 691575a7..8c213c71 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "hubspot/api-client", - "version": "14.0.5", + "version": "14.0.6", "description": "Hubspot API client", "keywords": [ "hubspot",