diff --git a/codegen/Crm/Tickets/Api/BasicApi.php b/codegen/Crm/Tickets/Api/BasicApi.php index e4c2b8b70..bfb680509 100644 --- a/codegen/Crm/Tickets/Api/BasicApi.php +++ b/codegen/Crm/Tickets/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; } @@ -139,7 +142,7 @@ public function getConfig() * * Archive * - * @param string $ticket_id ticket_id (required) + * @param string $ticket_id The ID of the ticket 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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -156,7 +159,7 @@ public function archive($ticket_id, string $contentType = self::contentTypes['ar * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket 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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -189,18 +192,6 @@ public function archiveWithHttpInfo($ticket_id, string $contentType = self::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() - ); - } return [null, $statusCode, $response->getHeaders()]; @@ -224,7 +215,7 @@ public function archiveWithHttpInfo($ticket_id, string $contentType = self::cont * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket 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 @@ -245,7 +236,7 @@ function ($response) { * * Archive * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket 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 +273,7 @@ function ($exception) { /** * Create request for operation 'archive' * - * @param string $ticket_id (required) + * @param string $ticket_id The ID of the ticket 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 @@ -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\Tickets\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -725,12 +717,12 @@ public function createRequest($simple_public_object_input_for_create, string $co * * Read * - * @param string $ticket_id ticket_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 $ticket_id The ID of the ticket. (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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -748,12 +740,12 @@ public function getById($ticket_id, $properties = null, $properties_with_history * * Read * - * @param string $ticket_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 $ticket_id The ID of the ticket. (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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -786,18 +778,6 @@ public function getByIdWithHttpInfo($ticket_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($ticket_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\Tickets\Model\SimplePublicObjectWithAssociations'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -912,12 +905,12 @@ public function getByIdWithHttpInfo($ticket_id, $properties = null, $properties_ * * Read * - * @param string $ticket_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 $ticket_id The ID of the ticket. (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 @@ -938,12 +931,12 @@ function ($response) { * * Read * - * @param string $ticket_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 $ticket_id The ID of the ticket. (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 $ticket_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 $ticket_id The ID of the ticket. (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 @@ -1146,12 +1139,12 @@ public function getByIdRequest($ticket_id, $properties = null, $properties_with_ * * 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\Tickets\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\Tickets\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\Tickets\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 tickets + * + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\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 tickets + * + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\HubSpot\Client\Crm\Tickets\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\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\Tickets\Model\SimplePublicObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\HubSpot\Client\Crm\Tickets\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation mergeAsync + * + * Merge two tickets + * + * @param \HubSpot\Client\Crm\Tickets\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 tickets + * + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\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/tickets/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 $ticket_id ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1584,7 +1924,7 @@ public function update($ticket_id, $simple_public_object_input, $id_property = n * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format @@ -1617,18 +1957,6 @@ public function updateWithHttpInfo($ticket_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 +2015,19 @@ public function updateWithHttpInfo($ticket_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\Tickets\Model\SimplePublicObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -1745,7 +2086,7 @@ public function updateWithHttpInfo($ticket_id, $simple_public_object_input, $id_ * * @param string $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\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 $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\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 $ticket_id (required) * @param \HubSpot\Client\Crm\Tickets\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/Tickets/Api/BatchApi.php b/codegen/Crm/Tickets/Api/BatchApi.php index 7df5f9c2d..144aca4a2 100644 --- a/codegen/Crm/Tickets/Api/BatchApi.php +++ b/codegen/Crm/Tickets/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 tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Tickets\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 tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObject|\HubSpot\Client\Crm\Tickets\Model\BatchResponseSimplePublicObjectWithErrors|\HubSpot\Client\Crm\Tickets\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\Tickets\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 tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\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 tickets * - * @param \HubSpot\Client\Crm\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\Model\BatchInputSimplePublicObjectInputForCreate $batch_input_simple_public_object_input_for_create (required) + * @param \HubSpot\Client\Crm\Tickets\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 tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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 tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\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 tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\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 tickets by internal ID, or unique property values * * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\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\Tickets\Model\BatchResponseSimplePublicUpsertObject'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer diff --git a/codegen/Crm/Tickets/Api/MergeApi.php b/codegen/Crm/Tickets/Api/MergeApi.php deleted file mode 100644 index beaa5018f..000000000 --- a/codegen/Crm/Tickets/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 tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\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 tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\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\Tickets\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \HubSpot\Client\Crm\Tickets\Model\SimplePublicObject|\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObject', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\HubSpot\Client\Crm\Tickets\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Crm\Tickets\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\Tickets\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\HubSpot\Client\Crm\Tickets\Model\Error', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation mergeAsync - * - * Merge two tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\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 tickets with same type - * - * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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\Tickets\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/tickets/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/Tickets/Api/SearchApi.php b/codegen/Crm/Tickets/Api/SearchApi.php index e8ec3350a..52816d05b 100644 --- a/codegen/Crm/Tickets/Api/SearchApi.php +++ b/codegen/Crm/Tickets/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 tickets + * * @param \HubSpot\Client\Crm\Tickets\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 tickets + * * @param \HubSpot\Client\Crm\Tickets\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\Tickets\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 tickets + * * @param \HubSpot\Client\Crm\Tickets\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 tickets + * * @param \HubSpot\Client\Crm\Tickets\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/Tickets/ApiException.php b/codegen/Crm/Tickets/ApiException.php index 763017f36..4bca973c5 100644 --- a/codegen/Crm/Tickets/ApiException.php +++ b/codegen/Crm/Tickets/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/Tickets/Configuration.php b/codegen/Crm/Tickets/Configuration.php index 3dff23171..82654dd88 100644 --- a/codegen/Crm/Tickets/Configuration.php +++ b/codegen/Crm/Tickets/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/Tickets/HeaderSelector.php b/codegen/Crm/Tickets/HeaderSelector.php index 99d272983..dc21001ad 100644 --- a/codegen/Crm/Tickets/HeaderSelector.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/AssociatedId.php b/codegen/Crm/Tickets/Model/AssociatedId.php index f9ff8cbdb..9e28bade1 100644 --- a/codegen/Crm/Tickets/Model/AssociatedId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/AssociationSpec.php b/codegen/Crm/Tickets/Model/AssociationSpec.php index eb0290e20..45f247d98 100644 --- a/codegen/Crm/Tickets/Model/AssociationSpec.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php index e85031332..2120c2ab4 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInput.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputForCreate.php similarity index 94% rename from codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php rename to codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputForCreate.php index 5cdb06941..d2a36a15d 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Tickets/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\Tickets\Model\SimplePublicObjectInputForCreate[]' + 'inputs' => '\HubSpot\Client\Crm\Tickets\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\Tickets\Model\SimplePublicObjectInputForCreate[] + * @return \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectBatchInputForCreate[] */ public function getInputs() { @@ -305,7 +305,7 @@ public function getInputs() /** * Sets inputs * - * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectInputForCreate[] $inputs inputs + * @param \HubSpot\Client\Crm\Tickets\Model\SimplePublicObjectBatchInputForCreate[] $inputs inputs * * @return self */ diff --git a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php index 4275c4974..cdc4960a3 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchInputSimplePublicObjectId.php b/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php index 6d4410422..f66343ac1 100644 --- a/codegen/Crm/Tickets/Model/BatchInputSimplePublicObjectId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchReadInputSimplePublicObjectId.php b/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php index 926bc13ff..c534a9892 100644 --- a/codegen/Crm/Tickets/Model/BatchReadInputSimplePublicObjectId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchResponseSimplePublicObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php index 8e67df2d8..c4f91572d 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObject.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php index 593ee1c9a..5678eaed5 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicObjectWithErrors.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchResponseSimplePublicUpsertObject.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php index fd8502e5a..75b541672 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObject.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php b/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php index 4ac93f3f7..100338bd5 100644 --- a/codegen/Crm/Tickets/Model/BatchResponseSimplePublicUpsertObjectWithErrors.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/CollectionResponseAssociatedId.php b/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php index 6a3489ecd..3afbd8eac 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseAssociatedId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php b/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php index 9248790bb..8c41ca85f 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseSimplePublicObjectWithAssociationsForwardPaging.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php b/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php index 0e78609fd..ae673a7e7 100644 --- a/codegen/Crm/Tickets/Model/CollectionResponseWithTotalSimplePublicObjectForwardPaging.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/Error.php b/codegen/Crm/Tickets/Model/Error.php index 1def01ada..9808eb5c3 100644 --- a/codegen/Crm/Tickets/Model/Error.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/ErrorDetail.php b/codegen/Crm/Tickets/Model/ErrorDetail.php index 051532703..129cde373 100644 --- a/codegen/Crm/Tickets/Model/ErrorDetail.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/Filter.php b/codegen/Crm/Tickets/Model/Filter.php index 9e3b56e5a..56425dd6c 100644 --- a/codegen/Crm/Tickets/Model/Filter.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/FilterGroup.php b/codegen/Crm/Tickets/Model/FilterGroup.php index 01a35ff27..ae7b77db2 100644 --- a/codegen/Crm/Tickets/Model/FilterGroup.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/ForwardPaging.php b/codegen/Crm/Tickets/Model/ForwardPaging.php index 543e581ba..885d979a7 100644 --- a/codegen/Crm/Tickets/Model/ForwardPaging.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/ModelInterface.php b/codegen/Crm/Tickets/Model/ModelInterface.php index 833116387..ffbf58994 100644 --- a/codegen/Crm/Tickets/Model/ModelInterface.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/NextPage.php b/codegen/Crm/Tickets/Model/NextPage.php index bcb4233a2..1e19b2e08 100644 --- a/codegen/Crm/Tickets/Model/NextPage.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/Paging.php b/codegen/Crm/Tickets/Model/Paging.php index a9cb3aa6b..e45b2a1d4 100644 --- a/codegen/Crm/Tickets/Model/Paging.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/PreviousPage.php b/codegen/Crm/Tickets/Model/PreviousPage.php index 405402c12..1ce1d8053 100644 --- a/codegen/Crm/Tickets/Model/PreviousPage.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/PublicAssociationsForObject.php b/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php index 8e79f8e54..9def38647 100644 --- a/codegen/Crm/Tickets/Model/PublicAssociationsForObject.php +++ b/codegen/Crm/Tickets/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\Tickets\Model\AssociationSpec[]|null + * @return \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] */ public function getTypes() { @@ -309,7 +315,7 @@ public function getTypes() /** * Sets types * - * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[]|null $types types + * @param \HubSpot\Client\Crm\Tickets\Model\AssociationSpec[] $types types * * @return self */ @@ -326,7 +332,7 @@ public function setTypes($types) /** * Gets to * - * @return \HubSpot\Client\Crm\Tickets\Model\PublicObjectId|null + * @return \HubSpot\Client\Crm\Tickets\Model\PublicObjectId */ public function getTo() { @@ -336,7 +342,7 @@ public function getTo() /** * Sets to * - * @param \HubSpot\Client\Crm\Tickets\Model\PublicObjectId|null $to to + * @param \HubSpot\Client\Crm\Tickets\Model\PublicObjectId $to to * * @return self */ diff --git a/codegen/Crm/Tickets/Model/PublicMergeInput.php b/codegen/Crm/Tickets/Model/PublicMergeInput.php index 3cf573d3f..f85495785 100644 --- a/codegen/Crm/Tickets/Model/PublicMergeInput.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/PublicObjectId.php b/codegen/Crm/Tickets/Model/PublicObjectId.php index 661d07c56..3dd1066a6 100644 --- a/codegen/Crm/Tickets/Model/PublicObjectId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/PublicObjectSearchRequest.php b/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php index 072e6265e..8fb36a3ae 100644 --- a/codegen/Crm/Tickets/Model/PublicObjectSearchRequest.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObject.php b/codegen/Crm/Tickets/Model/SimplePublicObject.php index b5c5e8060..51b8c186a 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObject.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObjectBatchInput.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php index fddd449cb..0c9a95c05 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInput.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObjectBatchInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputForCreate.php new file mode 100644 index 000000000..01514cfba --- /dev/null +++ b/codegen/Crm/Tickets/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\Tickets\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\Tickets\Model\PublicAssociationsForObject[]|null + */ + public function getAssociations() + { + return $this->container['associations']; + } + + /** + * Sets associations + * + * @param \HubSpot\Client\Crm\Tickets\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/Tickets/Model/SimplePublicObjectBatchInputUpsert.php b/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php index 1562434b5..06f232f57 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectBatchInputUpsert.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObjectId.php b/codegen/Crm/Tickets/Model/SimplePublicObjectId.php index 76a5772b5..b7d1e0657 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectId.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObjectInput.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php index 59a7df66f..36e533ad3 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInput.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicObjectInputForCreate.php b/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php index da8f6e6e2..a0987b342 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectInputForCreate.php +++ b/codegen/Crm/Tickets/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\Tickets\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/Tickets/Model/SimplePublicObjectWithAssociations.php b/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php index dc81abd10..08edc827e 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicObjectWithAssociations.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/SimplePublicUpsertObject.php b/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php index 7244e852f..7c4e42a4a 100644 --- a/codegen/Crm/Tickets/Model/SimplePublicUpsertObject.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/StandardError.php b/codegen/Crm/Tickets/Model/StandardError.php index 45b4b2693..4402ed411 100644 --- a/codegen/Crm/Tickets/Model/StandardError.php +++ b/codegen/Crm/Tickets/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/Tickets/Model/ValueWithTimestamp.php b/codegen/Crm/Tickets/Model/ValueWithTimestamp.php index a61b8c614..518d59ac8 100644 --- a/codegen/Crm/Tickets/Model/ValueWithTimestamp.php +++ b/codegen/Crm/Tickets/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/Tickets/ObjectSerializer.php b/codegen/Crm/Tickets/ObjectSerializer.php index 19e92baea..b84d3e8fa 100644 --- a/codegen/Crm/Tickets/ObjectSerializer.php +++ b/codegen/Crm/Tickets/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/lib/Discovery/Crm/Tickets/Discovery.php b/lib/Discovery/Crm/Tickets/Discovery.php index c18aa0f5c..f83fb5c4d 100644 --- a/lib/Discovery/Crm/Tickets/Discovery.php +++ b/lib/Discovery/Crm/Tickets/Discovery.php @@ -4,14 +4,12 @@ use HubSpot\Client\Crm\Tickets\Api\BasicApi; use HubSpot\Client\Crm\Tickets\Api\BatchApi; -use HubSpot\Client\Crm\Tickets\Api\MergeApi; use HubSpot\Client\Crm\Tickets\Api\SearchApi; use HubSpot\Discovery\Crm\ObjectDiscovery; /** * @method BasicApi basicApi() * @method BatchApi batchApi() - * @method MergeApi mergeApi() * @method SearchApi searchApi() */ class Discovery extends ObjectDiscovery {} diff --git a/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php b/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php index 6331a552d..a508b6b2a 100644 --- a/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php +++ b/tests/spec/Discovery/Crm/Tickets/DiscoverySpec.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use HubSpot\Client\Crm\Tickets\Api\BasicApi; use HubSpot\Client\Crm\Tickets\Api\BatchApi; -use HubSpot\Client\Crm\Tickets\Api\MergeApi; use HubSpot\Client\Crm\Tickets\Api\SearchApi; use HubSpot\Config; use HubSpot\Discovery\Crm\Tickets\Discovery; @@ -27,7 +26,6 @@ public function it_creates_clients() { $this->basicApi()->shouldHaveType(BasicApi::class); $this->batchApi()->shouldHaveType(BatchApi::class); - $this->mergeApi()->shouldHaveType(MergeApi::class); $this->searchApi()->shouldHaveType(SearchApi::class); } }