diff --git a/codegen/Crm/Companies/Api/BasicApi.php b/codegen/Crm/Companies/Api/BasicApi.php index 84a9ac97f..9137fe938 100644 --- a/codegen/Crm/Companies/Api/BasicApi.php +++ b/codegen/Crm/Companies/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,9 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +98,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +140,7 @@ public function getConfig() /** * Operation archive * - * Archive + * Archive a company * * @param string $company_id company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -154,7 +157,7 @@ public function archive($company_id, string $contentType = self::contentTypes['a /** * Operation archiveWithHttpInfo * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($company_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -222,7 +213,7 @@ public function archiveWithHttpInfo($company_id, string $contentType = self::con /** * Operation archiveAsync * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -243,7 +234,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive + * Archive a company * * @param string $company_id (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation @@ -378,7 +369,7 @@ public function archiveRequest($company_id, string $contentType = self::contentT /** * Operation create * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\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 @@ -396,7 +387,7 @@ public function create($simple_public_object_input_for_create, string $contentTy /** * Operation createWithHttpInfo * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\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 @@ -431,18 +422,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -501,6 +480,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -555,7 +547,7 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin /** * Operation createAsync * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\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 @@ -576,7 +568,7 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create + * Create a company * * @param \HubSpot\Client\Crm\Companies\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 @@ -723,14 +715,14 @@ public function createRequest($simple_public_object_input_for_create, string $co /** * Operation getById * - * Read + * Retrieve a company * - * @param string $company_id company_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -746,14 +738,14 @@ public function getById($company_id, $properties = null, $properties_with_histor /** * Operation getByIdWithHttpInfo * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -856,6 +836,19 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -910,14 +903,14 @@ public function getByIdWithHttpInfo($company_id, $properties = null, $properties /** * Operation getByIdAsync * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -936,14 +929,14 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Read + * Retrieve a company * - * @param string $company_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -993,12 +986,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $company_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string $company_id The ID of the company (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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1144,14 +1137,14 @@ public function getByIdRequest($company_id, $properties = null, $properties_with /** * Operation getPage * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1167,14 +1160,14 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert /** * Operation getPageWithHttpInfo * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1200,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1258,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1331,14 +1325,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu /** * Operation getPageAsync * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1357,14 +1351,14 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * List + * Retrieve companies * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1408,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1558,42 +1552,38 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ } /** - * Operation update + * Operation merge * - * Update + * Merge two companies * - * @param string $company_id company_id (required) - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error */ - public function update($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->updateWithHttpInfo($company_id, $simple_public_object_input, $id_property, $contentType); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation mergeWithHttpInfo * - * Update + * Merge two companies * - * @param string $company_id (required) - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->updateRequest($company_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1617,6 +1607,64 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Companies\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Companies\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1630,6 +1678,286 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id ); } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Companies\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two companies + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two companies + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'merge' + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/companies/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a company + * + * @param string $company_id company_id (required) + * @param \HubSpot\Client\Crm\Companies\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 $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error + */ + public function update($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($company_id, $simple_public_object_input, $id_property, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a company + * + * @param string $company_id (required) + * @param \HubSpot\Client\Crm\Companies\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 $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($company_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($company_id, $simple_public_object_input, $id_property, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { case 200: if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { @@ -1687,6 +2015,19 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1741,11 +2082,11 @@ public function updateWithHttpInfo($company_id, $simple_public_object_input, $id /** * Operation updateAsync * - * Update + * Update a company * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 @@ -1764,11 +2105,11 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update + * Update a company * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 @@ -1820,7 +2161,7 @@ function ($exception) { * * @param string $company_id (required) * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 diff --git a/codegen/Crm/Companies/Api/BatchApi.php b/codegen/Crm/Companies/Api/BatchApi.php index aade2b858..c18b0956c 100644 --- a/codegen/Crm/Companies/Api/BatchApi.php +++ b/codegen/Crm/Companies/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +137,7 @@ public function getConfig() /** * Operation archive * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -154,7 +154,7 @@ public function archive($batch_input_simple_public_object_id, string $contentTyp /** * Operation archiveWithHttpInfo * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -222,7 +210,7 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string /** * Operation archiveAsync * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -243,7 +231,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive a batch of companies by ID + * Archive a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\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\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\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\Companies\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of companies * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Companies\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Companies\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 \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -757,10 +746,10 @@ public function createRequest($batch_input_simple_public_object_input_for_create /** * Operation read * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -776,10 +765,10 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals /** * Operation readWithHttpInfo * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Companies\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -971,10 +961,10 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc /** * Operation readAsync * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -993,10 +983,10 @@ function ($response) { /** * Operation readAsyncWithHttpInfo * - * Read a batch of companies by internal ID, or unique property values + * Retrieve a batch of companies * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1152,7 +1142,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -1170,7 +1160,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1364,7 +1355,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -1385,7 +1376,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of companies by internal ID, or unique property values + * Update a batch of companies * * @param \HubSpot\Client\Crm\Companies\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 @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Companies/Api/MergeApi.php b/codegen/Crm/Companies/Api/MergeApi.php deleted file mode 100644 index 458d19f1d..000000000 --- a/codegen/Crm/Companies/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Companies\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Companies\Model\SimplePublicObject|\HubSpot\Client\Crm\Companies\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\Model\SimplePublicObject' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Companies\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Companies\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Companies\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Companies\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two companies with same type - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Companies\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'merge' - * - * @param \HubSpot\Client\Crm\Companies\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/companies/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Companies/Api/SearchApi.php b/codegen/Crm/Companies/Api/SearchApi.php index 9346ca736..e3b24edcd 100644 --- a/codegen/Crm/Companies/Api/SearchApi.php +++ b/codegen/Crm/Companies/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Companies\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for companies + * * @param \HubSpot\Client\Crm\Companies\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/Companies/ApiException.php b/codegen/Crm/Companies/ApiException.php index 028b11159..0528a4190 100644 --- a/codegen/Crm/Companies/ApiException.php +++ b/codegen/Crm/Companies/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Companies/Configuration.php b/codegen/Crm/Companies/Configuration.php index 14295abcc..73c8b4859 100644 --- a/codegen/Crm/Companies/Configuration.php +++ b/codegen/Crm/Companies/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Companies/HeaderSelector.php b/codegen/Crm/Companies/HeaderSelector.php index bd248b97f..8589ab34c 100644 --- a/codegen/Crm/Companies/HeaderSelector.php +++ b/codegen/Crm/Companies/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Companies/Model/AssociatedId.php b/codegen/Crm/Companies/Model/AssociatedId.php index 6c9377769..77c86c792 100644 --- a/codegen/Crm/Companies/Model/AssociatedId.php +++ b/codegen/Crm/Companies/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/AssociationSpec.php b/codegen/Crm/Companies/Model/AssociationSpec.php index b4195e939..2b6182b83 100644 --- a/codegen/Crm/Companies/Model/AssociationSpec.php +++ b/codegen/Crm/Companies/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category For [labeled associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#associate-records-with-a-label), the category of the association. * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id The [association type ID](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4#association-type-id-values) (e.g., `4` for contact-to-company associations). * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php index eed9bf187..886e16842 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index c28e16d38..d742549d4 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 399a836be..1ff245f04 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php index 3e8e071b1..f67266842 100644 --- a/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php index 49e55aef0..5fbde3d33 100644 --- a/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php index 7405c0ee9..a3ff31d99 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php index de21f709a..500ce4b87 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php index 1a10382d7..ec491ed29 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 83c111349..748cdb896 100644 --- a/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Companies/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php index c86d3d0d9..6fa4fcd1e 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Companies/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 45ff00df2..73d8acd54 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Companies/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index e5d6f8852..d3f0f8c54 100644 --- a/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Companies/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Error.php b/codegen/Crm/Companies/Model/Error.php index 34263a641..9e425ceb5 100644 --- a/codegen/Crm/Companies/Model/Error.php +++ b/codegen/Crm/Companies/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/ErrorDetail.php b/codegen/Crm/Companies/Model/ErrorDetail.php index a84459957..a921b8c14 100644 --- a/codegen/Crm/Companies/Model/ErrorDetail.php +++ b/codegen/Crm/Companies/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Filter.php b/codegen/Crm/Companies/Model/Filter.php index a81aa524b..07cec0957 100644 --- a/codegen/Crm/Companies/Model/Filter.php +++ b/codegen/Crm/Companies/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/FilterGroup.php b/codegen/Crm/Companies/Model/FilterGroup.php index 18b165981..b1d7c1425 100644 --- a/codegen/Crm/Companies/Model/FilterGroup.php +++ b/codegen/Crm/Companies/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/ForwardPaging.php b/codegen/Crm/Companies/Model/ForwardPaging.php index 556a12931..5f0507ff1 100644 --- a/codegen/Crm/Companies/Model/ForwardPaging.php +++ b/codegen/Crm/Companies/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/ModelInterface.php b/codegen/Crm/Companies/Model/ModelInterface.php index 0d3f70efd..43560fc27 100644 --- a/codegen/Crm/Companies/Model/ModelInterface.php +++ b/codegen/Crm/Companies/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Companies/Model/NextPage.php b/codegen/Crm/Companies/Model/NextPage.php index e0dcac946..ec20ba6a9 100644 --- a/codegen/Crm/Companies/Model/NextPage.php +++ b/codegen/Crm/Companies/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/Paging.php b/codegen/Crm/Companies/Model/Paging.php index 688d7398f..d89f2dba2 100644 --- a/codegen/Crm/Companies/Model/Paging.php +++ b/codegen/Crm/Companies/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/PreviousPage.php b/codegen/Crm/Companies/Model/PreviousPage.php index c1856f7f9..ff0917394 100644 --- a/codegen/Crm/Companies/Model/PreviousPage.php +++ b/codegen/Crm/Companies/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php index 3e89e8c13..ead698ea0 100644 --- a/codegen/Crm/Companies/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Companies/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Companies\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Companies\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Companies\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicMergeInput.php b/codegen/Crm/Companies/Model/PublicMergeInput.php index c5ff628ab..8769a2f25 100644 --- a/codegen/Crm/Companies/Model/PublicMergeInput.php +++ b/codegen/Crm/Companies/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); @@ -315,7 +315,7 @@ public function getObjectIdToMerge() /** * Sets object_id_to_merge * - * @param string $object_id_to_merge object_id_to_merge + * @param string $object_id_to_merge The ID of the company to merge into the primary. * * @return self */ @@ -342,7 +342,7 @@ public function getPrimaryObjectId() /** * Sets primary_object_id * - * @param string $primary_object_id primary_object_id + * @param string $primary_object_id The ID of the primary company, which the other will merge into. * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectId.php b/codegen/Crm/Companies/Model/PublicObjectId.php index 5f4b7d3e2..facf5c028 100644 --- a/codegen/Crm/Companies/Model/PublicObjectId.php +++ b/codegen/Crm/Companies/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id The ID of the target record to associate. * * @return self */ diff --git a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php index 2195bec71..9747b47f1 100644 --- a/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Companies/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/SimplePublicObject.php b/codegen/Crm/Companies/Model/SimplePublicObject.php index d68c65f74..11c9dbfa5 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObject.php +++ b/codegen/Crm/Companies/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php index 8aed582b3..bda2236c1 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -356,7 +356,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id object_write_trace_id + * @param string|null $object_write_trace_id In each input object, set this field to a unique ID value to enable more granular debugging for error responses. Learn more about [multi-status errors](https://developers.hubspot.com/docs/reference/api/other-resources/error-handling#multi-status-errors). * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID to be updated. This can be the object ID, or the unique property value of the `idProperty` property. * * @return self */ @@ -410,7 +410,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..4e1584851 --- /dev/null +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @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 = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + 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 associations + * + * @return \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php index 7fcc17cb1..e76573d5a 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -356,7 +356,7 @@ public function getObjectWriteTraceId() /** * Sets object_write_trace_id * - * @param string|null $object_write_trace_id object_write_trace_id + * @param string|null $object_write_trace_id In each input object, set this field to a unique ID value to enable more granular debugging for error responses. Learn more about [multi-status errors](https://developers.hubspot.com/docs/reference/api/other-resources/error-handling#multi-status-errors). * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID of the company to update. * * @return self */ @@ -410,7 +410,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectId.php b/codegen/Crm/Companies/Model/SimplePublicObjectId.php index 421b9acc3..63a5a8d39 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php index 54e096d25..5bfe468c5 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * @@ -339,7 +305,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php index f5dcae099..da44b6f9d 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Companies\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * @@ -373,7 +339,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties The company property values to set. * * @return self */ diff --git a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php index a778815cc..184fa2641 100644 --- a/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Companies/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php index e0bd3e59a..696a4eeed 100644 --- a/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Companies/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Companies/Model/StandardError.php b/codegen/Crm/Companies/Model/StandardError.php index 92ab4563b..615f0d636 100644 --- a/codegen/Crm/Companies/Model/StandardError.php +++ b/codegen/Crm/Companies/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Companies/Model/ValueWithTimestamp.php b/codegen/Crm/Companies/Model/ValueWithTimestamp.php index a2977109f..4359ac8de 100644 --- a/codegen/Crm/Companies/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Companies/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Companies/ObjectSerializer.php b/codegen/Crm/Companies/ObjectSerializer.php index 236e866d3..08d7e8bd0 100644 --- a/codegen/Crm/Companies/ObjectSerializer.php +++ b/codegen/Crm/Companies/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Contacts/Api/BasicApi.php b/codegen/Crm/Contacts/Api/BasicApi.php index 50bbc06c6..4100985a0 100644 --- a/codegen/Crm/Contacts/Api/BasicApi.php +++ b/codegen/Crm/Contacts/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,12 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], + 'purge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +101,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,9 +143,9 @@ public function getConfig() /** * Operation archive * - * Archive + * Archive a contact * - * @param string $contact_id contact_id (required) + * @param string $contact_id The ID of the contact to delete. (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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -154,9 +160,9 @@ public function archive($contact_id, string $contentType = self::contentTypes['a /** * Operation archiveWithHttpInfo * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +195,6 @@ public function archiveWithHttpInfo($contact_id, string $contentType = self::con $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -222,9 +216,9 @@ public function archiveWithHttpInfo($contact_id, string $contentType = self::con /** * Operation archiveAsync * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (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 @@ -243,9 +237,9 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive + * Archive a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (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 @@ -282,7 +276,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to delete. (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 @@ -378,7 +372,7 @@ public function archiveRequest($contact_id, string $contentType = self::contentT /** * Operation create * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\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 @@ -396,7 +390,7 @@ public function create($simple_public_object_input_for_create, string $contentTy /** * Operation createWithHttpInfo * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\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 @@ -431,18 +425,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -501,6 +483,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -555,7 +550,7 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin /** * Operation createAsync * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\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 @@ -576,7 +571,7 @@ function ($response) { /** * Operation createAsyncWithHttpInfo * - * Create + * Create a contact * * @param \HubSpot\Client\Crm\Contacts\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 @@ -723,14 +718,14 @@ public function createRequest($simple_public_object_input_for_create, string $co /** * Operation getById * - * Read + * Retrieve a contact * - * @param string $contact_id contact_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (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 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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -746,14 +741,14 @@ public function getById($contact_id, $properties = null, $properties_with_histor /** * Operation getByIdWithHttpInfo * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (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 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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +781,6 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -856,6 +839,19 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -910,14 +906,14 @@ public function getByIdWithHttpInfo($contact_id, $properties = null, $properties /** * Operation getByIdAsync * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (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 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 @@ -936,14 +932,14 @@ function ($response) { /** * Operation getByIdAsyncWithHttpInfo * - * Read + * Retrieve a contact * - * @param string $contact_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (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 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 @@ -993,12 +989,12 @@ function ($exception) { /** * Create request for operation 'getById' * - * @param string $contact_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string $contact_id The ID of the contact to retrieve. (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 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 @@ -1144,14 +1140,14 @@ public function getByIdRequest($contact_id, $properties = null, $properties_with /** * Operation getPage * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -1167,14 +1163,14 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert /** * Operation getPageWithHttpInfo * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1203,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1261,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1331,14 +1328,14 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu /** * Operation getPageAsync * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1357,14 +1354,14 @@ function ($response) { /** * Operation getPageAsyncWithHttpInfo * - * List + * Retrieve contacts * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1411,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1558,42 +1555,38 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ } /** - * Operation update + * Operation merge * - * Update + * Merge two contacts * - * @param string $contact_id contact_id (required) - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error */ - public function update($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - list($response) = $this->updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property, $contentType); + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); return $response; } /** - * Operation updateWithHttpInfo + * Operation mergeWithHttpInfo * - * Update + * Merge two contacts * - * @param string $contact_id (required) - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['update'] to see the possible values for this operation + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) { - $request = $this->updateRequest($contact_id, $simple_public_object_input, $id_property, $contentType); + $request = $this->mergeRequest($public_merge_input, $contentType); try { $options = $this->createHttpClientOption(); @@ -1617,18 +1610,6 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1687,6 +1668,597 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two contacts + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two contacts + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'merge' + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/contacts/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation purge + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); + } + + /** + * Operation purgeWithHttpInfo + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Contacts\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation purgeAsync + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation purgeAsyncWithHttpInfo + * + * Permanently delete a contact (GDPR-compliant) + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + $returnType = ''; + $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'purge' + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) + { + + // verify the required parameter 'public_gdpr_delete_input' is set + if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_gdpr_delete_input when calling purge' + ); + } + + + $resourcePath = '/crm/v3/objects/contacts/gdpr-delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_gdpr_delete_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); + } else { + $httpBody = $public_gdpr_delete_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation update + * + * Update a contact + * + * @param string $contact_id The ID of the contact to update. (required) + * @param \HubSpot\Client\Crm\Contacts\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 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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error + */ + public function update($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + list($response) = $this->updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property, $contentType); + return $response; + } + + /** + * Operation updateWithHttpInfo + * + * Update a contact + * + * @param string $contact_id The ID of the contact to update. (required) + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) + * @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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id_property = null, string $contentType = self::contentTypes['update'][0]) + { + $request = $this->updateRequest($contact_id, $simple_public_object_input, $id_property, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Contacts\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Contacts\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1741,11 +2313,11 @@ public function updateWithHttpInfo($contact_id, $simple_public_object_input, $id /** * Operation updateAsync * - * Update + * Update a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|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 @@ -1764,11 +2336,11 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update + * Update a contact * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|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 @@ -1818,9 +2390,9 @@ function ($exception) { /** * Create request for operation 'update' * - * @param string $contact_id (required) + * @param string $contact_id The ID of the contact to update. (required) * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object type (optional) + * @param string|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 diff --git a/codegen/Crm/Contacts/Api/BatchApi.php b/codegen/Crm/Contacts/Api/BatchApi.php index 545e4622f..739144b4c 100644 --- a/codegen/Crm/Contacts/Api/BatchApi.php +++ b/codegen/Crm/Contacts/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -137,7 +137,7 @@ public function getConfig() /** * Operation archive * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -154,7 +154,7 @@ public function archive($batch_input_simple_public_object_id, string $contentTyp /** * Operation archiveWithHttpInfo * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -222,7 +210,7 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string /** * Operation archiveAsync * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -243,7 +231,7 @@ function ($response) { /** * Operation archiveAsyncWithHttpInfo * - * Archive a batch of contacts by ID + * Archive a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of contacts * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Contacts\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Contacts\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 \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -757,10 +746,10 @@ public function createRequest($batch_input_simple_public_object_input_for_create /** * Operation read * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -776,10 +765,10 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals /** * Operation readWithHttpInfo * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Contacts\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -971,10 +961,10 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc /** * Operation readAsync * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -993,10 +983,10 @@ function ($response) { /** * Operation readAsyncWithHttpInfo * - * Read a batch of contacts by internal ID, or unique property values + * Retrieve a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1152,7 +1142,7 @@ public function readRequest($batch_read_input_simple_public_object_id, $archived /** * Operation update * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1170,7 +1160,7 @@ public function update($batch_input_simple_public_object_batch_input, string $co /** * Operation updateWithHttpInfo * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1364,7 +1355,7 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation updateAsync * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1385,7 +1376,7 @@ function ($response) { /** * Operation updateAsyncWithHttpInfo * - * Update a batch of contacts by internal ID, or unique property values + * Update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1532,7 +1523,7 @@ public function updateRequest($batch_input_simple_public_object_batch_input, str /** * Operation upsert * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1550,7 +1541,7 @@ public function upsert($batch_input_simple_public_object_batch_input_upsert, str /** * Operation upsertWithHttpInfo * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1744,7 +1736,7 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input /** * Operation upsertAsync * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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 @@ -1765,7 +1757,7 @@ function ($response) { /** * Operation upsertAsyncWithHttpInfo * - * Create or update a batch of contacts by unique property values + * Create or update a batch of contacts * * @param \HubSpot\Client\Crm\Contacts\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/Contacts/Api/GDPRApi.php b/codegen/Crm/Contacts/Api/GDPRApi.php deleted file mode 100644 index bfba65a12..000000000 --- a/codegen/Crm/Contacts/Api/GDPRApi.php +++ /dev/null @@ -1,383 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation purge - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function purge($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $this->purgeWithHttpInfo($public_gdpr_delete_input, $contentType); - } - - /** - * Operation purgeWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function purgeWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation purgeAsync - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsync($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - return $this->purgeAsyncWithHttpInfo($public_gdpr_delete_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation purgeAsyncWithHttpInfo - * - * GDPR DELETE - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function purgeAsyncWithHttpInfo($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - $returnType = ''; - $request = $this->purgeRequest($public_gdpr_delete_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'purge' - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicGdprDeleteInput $public_gdpr_delete_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['purge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function purgeRequest($public_gdpr_delete_input, string $contentType = self::contentTypes['purge'][0]) - { - - // verify the required parameter 'public_gdpr_delete_input' is set - if ($public_gdpr_delete_input === null || (is_array($public_gdpr_delete_input) && count($public_gdpr_delete_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_gdpr_delete_input when calling purge' - ); - } - - - $resourcePath = '/crm/v3/objects/contacts/gdpr-delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_gdpr_delete_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_gdpr_delete_input)); - } else { - $httpBody = $public_gdpr_delete_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Contacts/Api/MergeApi.php b/codegen/Crm/Contacts/Api/MergeApi.php deleted file mode 100644 index b0634af99..000000000 --- a/codegen/Crm/Contacts/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Contacts\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Contacts\Model\SimplePublicObject|\HubSpot\Client\Crm\Contacts\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Contacts\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Contacts\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Contacts\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Contacts\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two contacts with same type - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'merge' - * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/contacts/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Contacts/Api/SearchApi.php b/codegen/Crm/Contacts/Api/SearchApi.php index 82569ee04..259ef812a 100644 --- a/codegen/Crm/Contacts/Api/SearchApi.php +++ b/codegen/Crm/Contacts/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -125,6 +125,8 @@ public function getConfig() /** * Operation doSearch * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -141,6 +143,8 @@ public function doSearch($public_object_search_request, string $contentType = se /** * Operation doSearchWithHttpInfo * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -174,18 +178,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -244,6 +236,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Contacts\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -298,6 +303,8 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont /** * Operation doSearchAsync * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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 * @@ -317,6 +324,8 @@ function ($response) { /** * Operation doSearchAsyncWithHttpInfo * + * Search for contacts + * * @param \HubSpot\Client\Crm\Contacts\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/Contacts/ApiException.php b/codegen/Crm/Contacts/ApiException.php index 8bbe7208e..88f759608 100644 --- a/codegen/Crm/Contacts/ApiException.php +++ b/codegen/Crm/Contacts/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Contacts/Configuration.php b/codegen/Crm/Contacts/Configuration.php index a5be785fd..8ed9a3952 100644 --- a/codegen/Crm/Contacts/Configuration.php +++ b/codegen/Crm/Contacts/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Contacts/HeaderSelector.php b/codegen/Crm/Contacts/HeaderSelector.php index 54323e397..137b770f1 100644 --- a/codegen/Crm/Contacts/HeaderSelector.php +++ b/codegen/Crm/Contacts/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Contacts/Model/AssociatedId.php b/codegen/Crm/Contacts/Model/AssociatedId.php index e88f0a52c..fc20577a0 100644 --- a/codegen/Crm/Contacts/Model/AssociatedId.php +++ b/codegen/Crm/Contacts/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/AssociationSpec.php b/codegen/Crm/Contacts/Model/AssociationSpec.php index d2f609ff8..3051a702e 100644 --- a/codegen/Crm/Contacts/Model/AssociationSpec.php +++ b/codegen/Crm/Contacts/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category association_category * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php index 0b547166d..7536134c7 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index a79b30f12..f63fd8a8f 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 1e37e2acd..a901bf337 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php index e25e628bf..835586eef 100644 --- a/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php index dc9bead48..d1c35a8c8 100644 --- a/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php index a8801a0f7..5c446c9f1 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php index 5343c49d9..5eb2fd71b 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php index 712b889e7..2a64fbb5f 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 5fc4f8864..dec55d771 100644 --- a/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Contacts/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php index 3ea5f1e35..e56a6d87f 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index e72e6ec0b..65c8e6edf 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index db83f4141..117c58f72 100644 --- a/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Contacts/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Error.php b/codegen/Crm/Contacts/Model/Error.php index 14e173d98..5e9e2e98f 100644 --- a/codegen/Crm/Contacts/Model/Error.php +++ b/codegen/Crm/Contacts/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/ErrorDetail.php b/codegen/Crm/Contacts/Model/ErrorDetail.php index 5a18f46ad..b5f63dceb 100644 --- a/codegen/Crm/Contacts/Model/ErrorDetail.php +++ b/codegen/Crm/Contacts/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Filter.php b/codegen/Crm/Contacts/Model/Filter.php index 97f09eef9..c81e0ad2c 100644 --- a/codegen/Crm/Contacts/Model/Filter.php +++ b/codegen/Crm/Contacts/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/FilterGroup.php b/codegen/Crm/Contacts/Model/FilterGroup.php index 6962ae63c..855d6d0e5 100644 --- a/codegen/Crm/Contacts/Model/FilterGroup.php +++ b/codegen/Crm/Contacts/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/ForwardPaging.php b/codegen/Crm/Contacts/Model/ForwardPaging.php index 97a8aed0c..0c067eae6 100644 --- a/codegen/Crm/Contacts/Model/ForwardPaging.php +++ b/codegen/Crm/Contacts/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/ModelInterface.php b/codegen/Crm/Contacts/Model/ModelInterface.php index 7d8a45957..d3ccb82de 100644 --- a/codegen/Crm/Contacts/Model/ModelInterface.php +++ b/codegen/Crm/Contacts/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Contacts/Model/NextPage.php b/codegen/Crm/Contacts/Model/NextPage.php index f784c83ee..56b2b19bf 100644 --- a/codegen/Crm/Contacts/Model/NextPage.php +++ b/codegen/Crm/Contacts/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/Paging.php b/codegen/Crm/Contacts/Model/Paging.php index c3b7bca8e..c20a473d5 100644 --- a/codegen/Crm/Contacts/Model/Paging.php +++ b/codegen/Crm/Contacts/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PreviousPage.php b/codegen/Crm/Contacts/Model/PreviousPage.php index 104ee7f3b..9ef6be71a 100644 --- a/codegen/Crm/Contacts/Model/PreviousPage.php +++ b/codegen/Crm/Contacts/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php index a3aecce12..a320d2859 100644 --- a/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Contacts/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Contacts\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Contacts\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Contacts\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php b/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php index f75f51121..db9fa9541 100644 --- a/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php +++ b/codegen/Crm/Contacts/Model/PublicGdprDeleteInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_id', $data ?? [], null); @@ -312,7 +312,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object. An alternative to identifying a contact by ID. * * @return self */ @@ -339,7 +339,7 @@ public function getObjectId() /** * Sets object_id * - * @param string $object_id object_id + * @param string $object_id The ID of the contact to permanently delete. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicMergeInput.php b/codegen/Crm/Contacts/Model/PublicMergeInput.php index 168bb6472..a47e40ce9 100644 --- a/codegen/Crm/Contacts/Model/PublicMergeInput.php +++ b/codegen/Crm/Contacts/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/PublicObjectId.php b/codegen/Crm/Contacts/Model/PublicObjectId.php index 93e83f08b..76745247d 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectId.php +++ b/codegen/Crm/Contacts/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id id * * @return self */ diff --git a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php index 470555fa1..f6eb940b2 100644 --- a/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Contacts/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/SimplePublicObject.php b/codegen/Crm/Contacts/Model/SimplePublicObject.php index c0d2c2953..7e04dd7ff 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObject.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php index 2f900c1f1..5adec3daa 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a unique property, when identifying records by property. * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The ID of the contact to update. This can be the object ID, or the unique property value of the `idProperty` property. * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..8010972fb --- /dev/null +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @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 = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + 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 associations + * + * @return \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php index 4e73e5e26..e036c1de8 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectId.php b/codegen/Crm/Contacts/Model/SimplePublicObjectId.php index 617e14330..33bb98022 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php index 5cfb7dbf9..437c94260 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php index 2a0b7b78e..e0ddde7fd 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Contacts\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php index 2d00cb71d..f2981d949 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Contacts/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -417,7 +424,7 @@ public function getArchived() /** * Sets archived * - * @param bool|null $archived archived + * @param bool|null $archived * * @return self */ @@ -444,7 +451,7 @@ public function getArchivedAt() /** * Sets archived_at * - * @param \DateTime|null $archived_at archived_at + * @param \DateTime|null $archived_at * * @return self */ @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * @@ -525,7 +559,7 @@ public function getProperties() /** * Sets properties * - * @param array $properties properties + * @param array $properties * * @return self */ diff --git a/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php index 6373a477b..4c9c42014 100644 --- a/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Contacts/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Contacts/Model/StandardError.php b/codegen/Crm/Contacts/Model/StandardError.php index cb1182565..89f51c170 100644 --- a/codegen/Crm/Contacts/Model/StandardError.php +++ b/codegen/Crm/Contacts/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php index 41d4f2e11..427fa73a2 100644 --- a/codegen/Crm/Contacts/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Contacts/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Contacts/ObjectSerializer.php b/codegen/Crm/Contacts/ObjectSerializer.php index 340288eab..99bc90be3 100644 --- a/codegen/Crm/Contacts/ObjectSerializer.php +++ b/codegen/Crm/Contacts/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } } diff --git a/codegen/Crm/Deals/Api/BasicApi.php b/codegen/Crm/Deals/Api/BasicApi.php index 75ffd8330..5eff7e0c3 100644 --- a/codegen/Crm/Deals/Api/BasicApi.php +++ b/codegen/Crm/Deals/Api/BasicApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,6 +83,9 @@ class BasicApi 'getPage' => [ 'application/json', ], + 'merge' => [ + 'application/json', + ], 'update' => [ 'application/json', ], @@ -95,13 +98,13 @@ class BasicApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($deal_id, string $contentType = self::conten $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -431,18 +422,6 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -501,6 +480,19 @@ public function createWithHttpInfo($simple_public_object_input_for_create, strin ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -726,11 +718,11 @@ public function createRequest($simple_public_object_input_for_create, string $co * Read * * @param string $deal_id deal_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (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) + * @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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -749,11 +741,11 @@ public function getById($deal_id, $properties = null, $properties_with_history = * Read * * @param string $deal_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (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) + * @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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -856,6 +836,19 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -913,11 +906,11 @@ public function getByIdWithHttpInfo($deal_id, $properties = null, $properties_wi * Read * * @param string $deal_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (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) + * @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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -939,11 +932,11 @@ function ($response) { * Read * * @param string $deal_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (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) + * @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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -994,11 +987,11 @@ function ($exception) { * Create request for operation 'getById' * * @param string $deal_id (required) - * @param string[] $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[] $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[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) - * @param string $id_property The name of a property whose values are unique for this object (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) + * @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 $contentType The value for the Content-Type header. Check self::contentTypes['getById'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1146,12 +1139,12 @@ public function getByIdRequest($deal_id, $properties = null, $properties_with_hi * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1169,12 +1162,12 @@ public function getPage($limit = 10, $after = null, $properties = null, $propert * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1207,18 +1200,6 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1277,6 +1258,19 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseSimplePublicObjectWithAssociationsForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1333,12 +1327,12 @@ public function getPageWithHttpInfo($limit = 10, $after = null, $properties = nu * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1359,12 +1353,12 @@ function ($response) { * * List * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1414,12 +1408,12 @@ function ($exception) { /** * Create request for operation 'getPage' * - * @param int $limit The maximum number of results to display per page. (optional, default to 10) - * @param string $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[] $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[] $properties_with_history A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (optional) - * @param string[] $associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. (optional) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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) + * @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. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. (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 $contentType The value for the Content-Type header. Check self::contentTypes['getPage'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1557,6 +1551,352 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ ); } + /** + * Operation merge + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error + */ + public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); + return $response; + } + + /** + * Operation mergeWithHttpInfo + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $request = $this->mergeRequest($public_merge_input, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Deals\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Deals\Model\Error' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Deals\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation mergeAsyncWithHttpInfo + * + * Merge two deals with same type + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; + $request = $this->mergeRequest($public_merge_input, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'merge' + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) + { + + // verify the required parameter 'public_merge_input' is set + if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $public_merge_input when calling merge' + ); + } + + + $resourcePath = '/crm/v3/objects/deals/merge'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', '*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($public_merge_input)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); + } else { + $httpBody = $public_merge_input; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation update * @@ -1564,7 +1904,7 @@ public function getPageRequest($limit = 10, $after = null, $properties = null, $ * * @param string $deal_id deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input simple_public_object_input (required) - * @param string $id_property The name of a property whose values are unique for this object (optional) + * @param string|null $id_property The name of a property whose values are unique for this object (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\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1924,7 @@ public function update($deal_id, $simple_public_object_input, $id_property = nul * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1957,6 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1687,6 +2015,19 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +2086,7 @@ public function updateWithHttpInfo($deal_id, $simple_public_object_input, $id_pr * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 @@ -1768,7 +2109,7 @@ function ($response) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 @@ -1820,7 +2161,7 @@ function ($exception) { * * @param string $deal_id (required) * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInput $simple_public_object_input (required) - * @param string $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 (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 diff --git a/codegen/Crm/Deals/Api/BatchApi.php b/codegen/Crm/Deals/Api/BatchApi.php index 1e58ad29f..7051dbaa4 100644 --- a/codegen/Crm/Deals/Api/BatchApi.php +++ b/codegen/Crm/Deals/Api/BatchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -95,13 +95,13 @@ class BatchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -189,18 +189,6 @@ public function archiveWithHttpInfo($batch_input_simple_public_object_id, string $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -379,16 +367,16 @@ public function archiveRequest($batch_input_simple_public_object_id, string $con * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\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\Deals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error */ - public function create($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function create($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType); + list($response) = $this->createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType); return $response; } @@ -397,16 +385,16 @@ public function create($batch_input_simple_public_object_input_for_create, strin * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\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\Deals\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); try { $options = $this->createHttpClientOption(); @@ -430,18 +418,6 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 201: @@ -527,6 +503,19 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -591,15 +580,15 @@ public function createWithHttpInfo($batch_input_simple_public_object_input_for_c * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsync($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, $contentType) + return $this->createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, $contentType) ->then( function ($response) { return $response[0]; @@ -612,16 +601,16 @@ function ($response) { * * Create a batch of deals * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\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 \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createAsyncWithHttpInfo($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; - $request = $this->createRequest($batch_input_simple_public_object_input_for_create, $contentType); + $request = $this->createRequest($batch_input_simple_public_object_batch_input_for_create, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -662,19 +651,19 @@ function ($exception) { /** * Create request for operation 'create' * - * @param \HubSpot\Client\Crm\Deals\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Deals\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 \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($batch_input_simple_public_object_input_for_create, string $contentType = self::contentTypes['create'][0]) + public function createRequest($batch_input_simple_public_object_batch_input_for_create, string $contentType = self::contentTypes['create'][0]) { - // verify the required parameter 'batch_input_simple_public_object_input_for_create' is set - if ($batch_input_simple_public_object_input_for_create === null || (is_array($batch_input_simple_public_object_input_for_create) && count($batch_input_simple_public_object_input_for_create) === 0)) { + // verify the required parameter 'batch_input_simple_public_object_batch_input_for_create' is set + if ($batch_input_simple_public_object_batch_input_for_create === null || (is_array($batch_input_simple_public_object_batch_input_for_create) && count($batch_input_simple_public_object_batch_input_for_create) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $batch_input_simple_public_object_input_for_create when calling create' + 'Missing the required parameter $batch_input_simple_public_object_batch_input_for_create when calling create' ); } @@ -697,12 +686,12 @@ public function createRequest($batch_input_simple_public_object_input_for_create ); // for model (json/xml) - if (isset($batch_input_simple_public_object_input_for_create)) { + if (isset($batch_input_simple_public_object_batch_input_for_create)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_input_for_create)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($batch_input_simple_public_object_batch_input_for_create)); } else { - $httpBody = $batch_input_simple_public_object_input_for_create; + $httpBody = $batch_input_simple_public_object_batch_input_for_create; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -760,7 +749,7 @@ public function createRequest($batch_input_simple_public_object_input_for_create * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -779,7 +768,7 @@ public function read($batch_read_input_simple_public_object_id, $archived = fals * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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\Deals\ApiException on non-2xx response or if the response body is not in the expected format @@ -812,18 +801,6 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -909,6 +886,19 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -974,7 +964,7 @@ public function readWithHttpInfo($batch_read_input_simple_public_object_id, $arc * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -996,7 +986,7 @@ function ($response) { * Read a batch of deals by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1047,7 +1037,7 @@ function ($exception) { * Create request for operation 'read' * * @param \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId $batch_read_input_simple_public_object_id (required) - * @param bool $archived Whether to return only results that have been archived. (optional, default to false) + * @param 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 \InvalidArgumentException @@ -1205,18 +1195,6 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1302,6 +1280,19 @@ public function updateWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1585,18 +1576,6 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -1682,6 +1661,19 @@ public function upsertWithHttpInfo($batch_input_simple_public_object_batch_input ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Deals/Api/MergeApi.php b/codegen/Crm/Deals/Api/MergeApi.php deleted file mode 100644 index cc97229cd..000000000 --- a/codegen/Crm/Deals/Api/MergeApi.php +++ /dev/null @@ -1,488 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation merge - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error - */ - public function merge($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - list($response) = $this->mergeWithHttpInfo($public_merge_input, $contentType); - return $response; - } - - /** - * Operation mergeWithHttpInfo - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \HubSpot\Client\Crm\Deals\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Deals\Model\SimplePublicObject|\HubSpot\Client\Crm\Deals\Model\Error, HTTP status code, HTTP response headers (array of strings) - */ - public function mergeWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $request = $this->mergeRequest($public_merge_input, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\Model\SimplePublicObject' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Deals\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Deals\Model\Error' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\HubSpot\Client\Crm\Deals\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Deals\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsync($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - return $this->mergeAsyncWithHttpInfo($public_merge_input, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation mergeAsyncWithHttpInfo - * - * Merge two deals - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function mergeAsyncWithHttpInfo($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - $returnType = '\HubSpot\Client\Crm\Deals\Model\SimplePublicObject'; - $request = $this->mergeRequest($public_merge_input, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'merge' - * - * @param \HubSpot\Client\Crm\Deals\Model\PublicMergeInput $public_merge_input (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['merge'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function mergeRequest($public_merge_input, string $contentType = self::contentTypes['merge'][0]) - { - - // verify the required parameter 'public_merge_input' is set - if ($public_merge_input === null || (is_array($public_merge_input) && count($public_merge_input) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $public_merge_input when calling merge' - ); - } - - - $resourcePath = '/crm/v3/objects/deals/merge'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', '*/*', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($public_merge_input)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($public_merge_input)); - } else { - $httpBody = $public_merge_input; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires OAuth (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/codegen/Crm/Deals/Api/SearchApi.php b/codegen/Crm/Deals/Api/SearchApi.php index a87ca1d85..731b3e519 100644 --- a/codegen/Crm/Deals/Api/SearchApi.php +++ b/codegen/Crm/Deals/Api/SearchApi.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -83,13 +83,13 @@ class SearchApi * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); $this->headerSelector = $selector ?: new HeaderSelector(); $this->hostIndex = $hostIndex; } @@ -174,18 +174,6 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont $statusCode = $response->getStatusCode(); - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } switch($statusCode) { case 200: @@ -244,6 +232,19 @@ public function doSearchWithHttpInfo($public_object_search_request, string $cont ]; } + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + $returnType = '\HubSpot\Client\Crm\Deals\Model\CollectionResponseWithTotalSimplePublicObjectForwardPaging'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Deals/ApiException.php b/codegen/Crm/Deals/ApiException.php index f2fc151aa..af6e6ab4a 100644 --- a/codegen/Crm/Deals/ApiException.php +++ b/codegen/Crm/Deals/ApiException.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -49,7 +49,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -65,7 +65,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -78,7 +78,7 @@ public function __construct($message = "", $code = 0, $responseHeaders = [], $re /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/codegen/Crm/Deals/Configuration.php b/codegen/Crm/Deals/Configuration.php index 1b3564157..6f4fbf83f 100644 --- a/codegen/Crm/Deals/Configuration.php +++ b/codegen/Crm/Deals/Configuration.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -486,7 +486,7 @@ public function getHostSettings() * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostSettings, $hostIndex, ?array $variables = null) { if (null === $variables) { $variables = []; diff --git a/codegen/Crm/Deals/HeaderSelector.php b/codegen/Crm/Deals/HeaderSelector.php index ef0486de0..490304038 100644 --- a/codegen/Crm/Deals/HeaderSelector.php +++ b/codegen/Crm/Deals/HeaderSelector.php @@ -16,7 +16,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -85,7 +85,7 @@ private function selectAcceptHeader(array $accept): ?string } # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + $headersWithJson = $this->selectJsonMimeList($accept); if (count($headersWithJson) === 0) { return implode(',', $accept); } @@ -95,6 +95,34 @@ private function selectAcceptHeader(array $accept): ?string return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + /** * Create an Accept header string from the given "Accept" headers array, recalculating all weights * diff --git a/codegen/Crm/Deals/Model/AssociatedId.php b/codegen/Crm/Deals/Model/AssociatedId.php index 181dc60e6..ba5f109e2 100644 --- a/codegen/Crm/Deals/Model/AssociatedId.php +++ b/codegen/Crm/Deals/Model/AssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/AssociationSpec.php b/codegen/Crm/Deals/Model/AssociationSpec.php index 59f1d521c..653b30cce 100644 --- a/codegen/Crm/Deals/Model/AssociationSpec.php +++ b/codegen/Crm/Deals/Model/AssociationSpec.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -262,10 +262,10 @@ public function getAssociationCategoryAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('association_category', $data ?? [], null); $this->setIfExists('association_type_id', $data ?? [], null); @@ -298,6 +298,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['association_category'] === null) { + $invalidProperties[] = "'association_category' can't be null"; + } $allowedValues = $this->getAssociationCategoryAllowableValues(); if (!is_null($this->container['association_category']) && !in_array($this->container['association_category'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -307,6 +310,9 @@ public function listInvalidProperties() ); } + if ($this->container['association_type_id'] === null) { + $invalidProperties[] = "'association_type_id' can't be null"; + } return $invalidProperties; } @@ -325,7 +331,7 @@ public function valid() /** * Gets association_category * - * @return string|null + * @return string */ public function getAssociationCategory() { @@ -335,7 +341,7 @@ public function getAssociationCategory() /** * Sets association_category * - * @param string|null $association_category association_category + * @param string $association_category association_category * * @return self */ @@ -362,7 +368,7 @@ public function setAssociationCategory($association_category) /** * Gets association_type_id * - * @return int|null + * @return int */ public function getAssociationTypeId() { @@ -372,7 +378,7 @@ public function getAssociationTypeId() /** * Sets association_type_id * - * @param int|null $association_type_id association_type_id + * @param int $association_type_id association_type_id * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php index c691870b3..4d88ea1c5 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index fc9888cae..477b137e3 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputForCreate.php @@ -1,6 +1,6 @@ */ -class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +class BatchInputSimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -49,7 +49,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * * @var string */ - protected static $openAPIModelName = 'BatchInputSimplePublicObjectInputForCreate'; + protected static $openAPIModelName = 'BatchInputSimplePublicObjectBatchInputForCreate'; /** * Array of property to type mappings. Used for (de)serialization @@ -57,7 +57,7 @@ class BatchInputSimplePublicObjectInputForCreate implements ModelInterface, Arra * @var string[] */ protected static $openAPITypes = [ - 'inputs' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[]' ]; /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } @@ -295,7 +295,7 @@ public function valid() /** * Gets inputs * - * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 8914f0a6f..4c1442f7d 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php index 09b3696f2..7bbd3b045 100644 --- a/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/BatchInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('inputs', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php index c3a95cb2d..ca930afeb 100644 --- a/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/BatchReadInputSimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id_property', $data ?? [], null); @@ -359,7 +359,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property When using a custom unique value property to retrieve records, the name of the property. Do not include this parameter if retrieving by record ID. * * @return self */ diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php index d6f0d8ea8..48e197542 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php index abda838cf..8024f948c 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php index b6b4c84b0..b72b4cc0d 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -288,10 +288,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 0edd2e58b..5c8224b46 100644 --- a/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Deals/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getStatusAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('completed_at', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php index 74342afda..f5e52073a 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Deals/Model/CollectionResponseAssociatedId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 83489077b..924db2c10 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Deals/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('paging', $data ?? [], null); $this->setIfExists('results', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index b75849f42..8c7291707 100644 --- a/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Deals/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -251,10 +251,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('total', $data ?? [], null); $this->setIfExists('paging', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Error.php b/codegen/Crm/Deals/Model/Error.php index d4098ace5..c011f7e1b 100644 --- a/codegen/Crm/Deals/Model/Error.php +++ b/codegen/Crm/Deals/Model/Error.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -275,10 +275,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/ErrorDetail.php b/codegen/Crm/Deals/Model/ErrorDetail.php index 66d28d4a4..79263319c 100644 --- a/codegen/Crm/Deals/Model/ErrorDetail.php +++ b/codegen/Crm/Deals/Model/ErrorDetail.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -263,10 +263,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Filter.php b/codegen/Crm/Deals/Model/Filter.php index 5d4565347..2ca89cd2e 100644 --- a/codegen/Crm/Deals/Model/Filter.php +++ b/codegen/Crm/Deals/Model/Filter.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -300,10 +300,10 @@ public function getOperatorAllowableValues() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('high_value', $data ?? [], null); $this->setIfExists('property_name', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/FilterGroup.php b/codegen/Crm/Deals/Model/FilterGroup.php index 2ef054dc0..6290dabb2 100644 --- a/codegen/Crm/Deals/Model/FilterGroup.php +++ b/codegen/Crm/Deals/Model/FilterGroup.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('filters', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/ForwardPaging.php b/codegen/Crm/Deals/Model/ForwardPaging.php index c5f2f6bde..ddd444dfe 100644 --- a/codegen/Crm/Deals/Model/ForwardPaging.php +++ b/codegen/Crm/Deals/Model/ForwardPaging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/ModelInterface.php b/codegen/Crm/Deals/Model/ModelInterface.php index 513396fad..b0b84f51d 100644 --- a/codegen/Crm/Deals/Model/ModelInterface.php +++ b/codegen/Crm/Deals/Model/ModelInterface.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** diff --git a/codegen/Crm/Deals/Model/NextPage.php b/codegen/Crm/Deals/Model/NextPage.php index 50744c1b5..afec5b37f 100644 --- a/codegen/Crm/Deals/Model/NextPage.php +++ b/codegen/Crm/Deals/Model/NextPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/Paging.php b/codegen/Crm/Deals/Model/Paging.php index 029051a00..b7e85866e 100644 --- a/codegen/Crm/Deals/Model/Paging.php +++ b/codegen/Crm/Deals/Model/Paging.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('next', $data ?? [], null); $this->setIfExists('prev', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PreviousPage.php b/codegen/Crm/Deals/Model/PreviousPage.php index da2794f8d..7129bfe72 100644 --- a/codegen/Crm/Deals/Model/PreviousPage.php +++ b/codegen/Crm/Deals/Model/PreviousPage.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('before', $data ?? [], null); $this->setIfExists('link', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php index 51949fc21..03851560d 100644 --- a/codegen/Crm/Deals/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Deals/Model/PublicAssociationsForObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('types', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); @@ -281,6 +281,12 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['types'] === null) { + $invalidProperties[] = "'types' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } return $invalidProperties; } @@ -299,7 +305,7 @@ public function valid() /** * Gets types * - * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Deals\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Deals\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Deals\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicMergeInput.php b/codegen/Crm/Deals/Model/PublicMergeInput.php index cff3e3294..09865548c 100644 --- a/codegen/Crm/Deals/Model/PublicMergeInput.php +++ b/codegen/Crm/Deals/Model/PublicMergeInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -245,10 +245,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('object_id_to_merge', $data ?? [], null); $this->setIfExists('primary_object_id', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/PublicObjectId.php b/codegen/Crm/Deals/Model/PublicObjectId.php index 76e487cc6..0aaa678f5 100644 --- a/codegen/Crm/Deals/Model/PublicObjectId.php +++ b/codegen/Crm/Deals/Model/PublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } @@ -274,6 +274,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } return $invalidProperties; } @@ -292,7 +295,7 @@ public function valid() /** * Gets id * - * @return string|null + * @return string */ public function getId() { @@ -302,7 +305,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string $id id * * @return self */ diff --git a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php index 0251d13dd..580843957 100644 --- a/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Deals/Model/PublicObjectSearchRequest.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('query', $data ?? [], null); $this->setIfExists('limit', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/SimplePublicObject.php b/codegen/Crm/Deals/Model/SimplePublicObject.php index a1b9b705f..314c1c5d9 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObject.php +++ b/codegen/Crm/Deals/Model/SimplePublicObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -62,6 +62,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -79,6 +80,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -94,6 +96,7 @@ class SimplePublicObject implements ModelInterface, ArrayAccess, \JsonSerializab 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -189,6 +192,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -204,6 +208,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -219,6 +224,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -275,16 +281,17 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -478,6 +485,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php index c20d09603..5cdf6f9be 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ @@ -383,7 +383,7 @@ public function getId() /** * Sets id * - * @param string $id id + * @param string $id The id to be updated. This can be the object id, or the unique property value of the idProperty property * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..8593abb31 --- /dev/null +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputForCreate.php @@ -0,0 +1,480 @@ + + */ +class SimplePublicObjectBatchInputForCreate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SimplePublicObjectBatchInputForCreate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'associations' => '\HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]', + 'object_write_trace_id' => 'string', + 'properties' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'associations' => null, + 'object_write_trace_id' => null, + 'properties' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'associations' => false, + 'object_write_trace_id' => false, + 'properties' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @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 = [ + 'associations' => 'associations', + 'object_write_trace_id' => 'objectWriteTraceId', + 'properties' => 'properties' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'associations' => 'setAssociations', + 'object_write_trace_id' => 'setObjectWriteTraceId', + 'properties' => 'setProperties' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'associations' => 'getAssociations', + 'object_write_trace_id' => 'getObjectWriteTraceId', + 'properties' => 'getProperties' + ]; + + /** + * 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('associations', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); + $this->setIfExists('properties', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['properties'] === null) { + $invalidProperties[] = "'properties' can't be null"; + } + 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 associations + * + * @return \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]|null $associations associations + * + * @return self + */ + public function setAssociations($associations) + { + if (is_null($associations)) { + throw new \InvalidArgumentException('non-nullable associations cannot be null'); + } + $this->container['associations'] = $associations; + + return $this; + } + + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + + /** + * Gets properties + * + * @return array + */ + public function getProperties() + { + return $this->container['properties']; + } + + /** + * Sets properties + * + * @param array $properties properties + * + * @return self + */ + public function setProperties($properties) + { + if (is_null($properties)) { + throw new \InvalidArgumentException('non-nullable properties cannot be null'); + } + $this->container['properties'] = $properties; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php index 41103472f..74aa5ceb7 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectBatchInputUpsert.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -257,10 +257,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id_property', $data ?? [], null); $this->setIfExists('object_write_trace_id', $data ?? [], null); @@ -329,7 +329,7 @@ public function getIdProperty() /** * Sets id_property * - * @param string|null $id_property id_property + * @param string|null $id_property The name of a property whose values are unique for this object * * @return self */ diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectId.php b/codegen/Crm/Deals/Model/SimplePublicObjectId.php index e9369952a..646ace610 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectId.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -239,10 +239,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); } diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php index 68034dc1a..d55d7a7b9 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInput.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -57,7 +57,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -69,7 +68,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'object_write_trace_id' => null, 'properties' => null ]; @@ -79,7 +77,6 @@ class SimplePublicObjectInput implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'object_write_trace_id' => false, 'properties' => false ]; @@ -169,7 +166,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -179,7 +175,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -189,7 +184,6 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -245,12 +239,11 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -299,33 +292,6 @@ public function valid() } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php index 803bfebf6..ff6183c7f 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectInputForCreate.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,7 +58,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPITypes = [ 'associations' => '\HubSpot\Client\Crm\Deals\Model\PublicAssociationsForObject[]', - 'object_write_trace_id' => 'string', 'properties' => 'array' ]; @@ -71,7 +70,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static $openAPIFormats = [ 'associations' => null, - 'object_write_trace_id' => null, 'properties' => null ]; @@ -82,7 +80,6 @@ class SimplePublicObjectInputForCreate implements ModelInterface, ArrayAccess, \ */ protected static array $openAPINullables = [ 'associations' => false, - 'object_write_trace_id' => false, 'properties' => false ]; @@ -173,7 +170,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'associations' => 'associations', - 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties' ]; @@ -184,7 +180,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'associations' => 'setAssociations', - 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties' ]; @@ -195,7 +190,6 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'associations' => 'getAssociations', - 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties' ]; @@ -251,13 +245,12 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); - $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); } @@ -333,33 +326,6 @@ public function setAssociations($associations) return $this; } - /** - * Gets object_write_trace_id - * - * @return string|null - */ - public function getObjectWriteTraceId() - { - return $this->container['object_write_trace_id']; - } - - /** - * Sets object_write_trace_id - * - * @param string|null $object_write_trace_id object_write_trace_id - * - * @return self - */ - public function setObjectWriteTraceId($object_write_trace_id) - { - if (is_null($object_write_trace_id)) { - throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); - } - $this->container['object_write_trace_id'] = $object_write_trace_id; - - return $this; - } - /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php index 496d7aa54..31ee04245 100644 --- a/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Deals/Model/SimplePublicObjectWithAssociations.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => '\DateTime', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => 'date-time', 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicObjectWithAssociations implements ModelInterface, ArrayAccess, 'archived_at' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'archivedAt', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'setArchivedAt', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'archived_at' => 'getArchivedAt', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('associations', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('archived_at', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -512,6 +519,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php index 927175ea4..40f3c24dd 100644 --- a/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Deals/Model/SimplePublicUpsertObject.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -63,6 +63,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => 'bool', 'properties_with_history' => 'array', 'id' => 'string', + 'object_write_trace_id' => 'string', 'properties' => 'array', 'updated_at' => '\DateTime' ]; @@ -81,6 +82,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => null, 'properties_with_history' => null, 'id' => null, + 'object_write_trace_id' => null, 'properties' => null, 'updated_at' => 'date-time' ]; @@ -97,6 +99,7 @@ class SimplePublicUpsertObject implements ModelInterface, ArrayAccess, \JsonSeri 'new' => false, 'properties_with_history' => false, 'id' => false, + 'object_write_trace_id' => false, 'properties' => false, 'updated_at' => false ]; @@ -193,6 +196,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'new', 'properties_with_history' => 'propertiesWithHistory', 'id' => 'id', + 'object_write_trace_id' => 'objectWriteTraceId', 'properties' => 'properties', 'updated_at' => 'updatedAt' ]; @@ -209,6 +213,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'setNew', 'properties_with_history' => 'setPropertiesWithHistory', 'id' => 'setId', + 'object_write_trace_id' => 'setObjectWriteTraceId', 'properties' => 'setProperties', 'updated_at' => 'setUpdatedAt' ]; @@ -225,6 +230,7 @@ public function isNullableSetToNull(string $property): bool 'new' => 'getNew', 'properties_with_history' => 'getPropertiesWithHistory', 'id' => 'getId', + 'object_write_trace_id' => 'getObjectWriteTraceId', 'properties' => 'getProperties', 'updated_at' => 'getUpdatedAt' ]; @@ -281,10 +287,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); @@ -292,6 +298,7 @@ public function __construct(array $data = null) $this->setIfExists('new', $data ?? [], null); $this->setIfExists('properties_with_history', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('object_write_trace_id', $data ?? [], null); $this->setIfExists('properties', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -515,6 +522,33 @@ public function setId($id) return $this; } + /** + * Gets object_write_trace_id + * + * @return string|null + */ + public function getObjectWriteTraceId() + { + return $this->container['object_write_trace_id']; + } + + /** + * Sets object_write_trace_id + * + * @param string|null $object_write_trace_id object_write_trace_id + * + * @return self + */ + public function setObjectWriteTraceId($object_write_trace_id) + { + if (is_null($object_write_trace_id)) { + throw new \InvalidArgumentException('non-nullable object_write_trace_id cannot be null'); + } + $this->container['object_write_trace_id'] = $object_write_trace_id; + + return $this; + } + /** * Gets properties * diff --git a/codegen/Crm/Deals/Model/StandardError.php b/codegen/Crm/Deals/Model/StandardError.php index 5ec3112b3..35dfcc0e1 100644 --- a/codegen/Crm/Deals/Model/StandardError.php +++ b/codegen/Crm/Deals/Model/StandardError.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -281,10 +281,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); diff --git a/codegen/Crm/Deals/Model/ValueWithTimestamp.php b/codegen/Crm/Deals/Model/ValueWithTimestamp.php index ca1bfc21c..c42b4042d 100644 --- a/codegen/Crm/Deals/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Deals/Model/ValueWithTimestamp.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -269,10 +269,10 @@ public function getModelName() /** * Constructor * - * @param mixed[] $data Associated array of property values + * @param mixed[]|null $data Associated array of property values * initializing the model */ - public function __construct(array $data = null) + public function __construct(?array $data = null) { $this->setIfExists('source_id', $data ?? [], null); $this->setIfExists('source_type', $data ?? [], null); diff --git a/codegen/Crm/Deals/ObjectSerializer.php b/codegen/Crm/Deals/ObjectSerializer.php index f7efa4fef..d9390c41c 100644 --- a/codegen/Crm/Deals/ObjectSerializer.php +++ b/codegen/Crm/Deals/ObjectSerializer.php @@ -17,7 +17,7 @@ * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 7.3.0 + * Generator version: 7.12.0 */ /** @@ -58,8 +58,8 @@ public static function setDateTimeFormat($format) * Serialize data * * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ @@ -194,6 +194,10 @@ private static function isEmptyValue($value, string $openApiType): bool case 'boolean': return !in_array($value, [false, 0], true); + # For string values, '' is considered empty. + case 'string': + return $value === ''; + # For all the other types, any value at this point can be considered empty. default: return true; @@ -265,6 +269,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -338,7 +347,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -395,8 +404,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param string[]|null $httpHeaders HTTP headers * * @return object|array|null a single or an array of $class instances */ @@ -473,7 +481,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); @@ -546,22 +554,64 @@ public static function deserialize($data, $class, $httpHeaders = null) } /** - * Native `http_build_query` wrapper. - * @see https://www.php.net/manual/en/function.http-build-query - * - * @param array|object $data May be an array or object containing properties. - * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. - * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. - * - * @return string - */ - public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 - ): string { - return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; } }