From 098a18d3eadefac7de6fd2ef97256ef8d4336008 Mon Sep 17 00:00:00 2001 From: ksvirkou-hubspot Date: Thu, 12 Feb 2026 15:24:58 +0300 Subject: [PATCH] Codegen: Files --- codegen/Files/Api/FilesApi.php | 1426 ++++++----------- codegen/Files/Api/FoldersApi.php | 861 +++------- codegen/Files/ApiException.php | 6 +- codegen/Files/Configuration.php | 65 +- codegen/Files/FormDataProcessor.php | 246 +++ codegen/Files/HeaderSelector.php | 6 +- .../Files/Model/CollectionResponseFile.php | 20 +- .../Files/Model/CollectionResponseFolder.php | 20 +- codegen/Files/Model/Error.php | 160 +- codegen/Files/Model/ErrorDetail.php | 136 +- codegen/Files/Model/File.php | 690 ++++---- codegen/Files/Model/FileActionResponse.php | 276 ++-- codegen/Files/Model/FileStat.php | 18 +- codegen/Files/Model/FileUpdateInput.php | 208 +-- codegen/Files/Model/Folder.php | 210 +-- codegen/Files/Model/FolderActionResponse.php | 274 ++-- codegen/Files/Model/FolderInput.php | 100 +- codegen/Files/Model/FolderUpdateInput.php | 84 +- .../Files/Model/FolderUpdateInputWithId.php | 88 +- .../Files/Model/FolderUpdateTaskLocator.php | 90 +- codegen/Files/Model/ImportFromUrlInput.php | 312 ++-- .../Files/Model/ImportFromUrlTaskLocator.php | 90 +- codegen/Files/Model/ModelInterface.php | 6 +- codegen/Files/Model/NextPage.php | 85 +- codegen/Files/Model/Paging.php | 18 +- codegen/Files/Model/PreviousPage.php | 23 +- codegen/Files/Model/SignedUrl.php | 202 +-- codegen/Files/Model/StandardError.php | 205 +-- codegen/Files/ObjectSerializer.php | 26 +- 29 files changed, 2694 insertions(+), 3257 deletions(-) create mode 100644 codegen/Files/FormDataProcessor.php diff --git a/codegen/Files/Api/FilesApi.php b/codegen/Files/Api/FilesApi.php index a1d956e8..a749c622 100644 --- a/codegen/Files/Api/FilesApi.php +++ b/codegen/Files/Api/FilesApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -219,8 +221,10 @@ public function archiveWithHttpInfo($file_id, string $contentType = self::conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -443,61 +447,21 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\FileActionResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FileActionResponse' !== '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\Files\Model\FileActionResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FileActionResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -511,34 +475,11 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co ); } - $returnType = '\HubSpot\Client\Files\Model\FileActionResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FileActionResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -548,7 +489,7 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -556,8 +497,10 @@ public function checkImportWithHttpInfo($task_id, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -788,7 +731,6 @@ public function deleteWithHttpInfo($file_id, string $contentType = self::content return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -798,8 +740,10 @@ public function deleteWithHttpInfo($file_id, string $contentType = self::content $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -968,42 +912,42 @@ public function deleteRequest($file_id, string $contentType = self::contentTypes * * Search files * - * @param string[]|null $properties A list of file properties to return. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string[]|null $properties Desired file properties in the return object. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search files updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort files by a given field. (optional) - * @param int[]|null $ids Search by a list of file IDs. (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) - * @param \DateTime|null $created_at Search files by time of creation. (optional) - * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) - * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) - * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) - * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) - * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte Search files by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search files by greater than or equal to ID. Can be used with idLte to create a range. (optional) + * @param \DateTime|null $created_at Search files by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search files by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for files containing the given name. (optional) * @param string|null $path Search files by path. (optional) - * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param int|null $size Search files by exact file size in bytes. (optional) - * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) - * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with sizeGte to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with sizeLte to create a range. (optional) * @param int|null $height Search files by height of image or video. (optional) - * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) - * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with heightGte to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with heightLte to create a range. (optional) * @param int|null $width Search files by width of image or video. (optional) - * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) - * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with widthGte to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with widthLte to create a range. (optional) * @param string|null $encoding Search files by specified encoding. (optional) - * @param string|null $type Filter by provided file type. (optional) + * @param string|null $type Search files by file type. (optional) * @param string|null $extension Search files by given extension. (optional) - * @param string|null $url Search by file URL. (optional) - * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) - * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) - * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param string|null $url Search for given URL (optional) + * @param bool|null $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If 'true' will show only public files; if 'false' will show only private files (optional) + * @param string|null $file_md5 Search files by specific md5 hash. (optional) * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) - * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) - * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with expiresAtGte to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with expiresAtLte to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1021,42 +965,42 @@ public function doSearch($properties = null, $after = null, $before = null, $lim * * Search files * - * @param string[]|null $properties A list of file properties to return. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string[]|null $properties Desired file properties in the return object. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search files updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort files by a given field. (optional) - * @param int[]|null $ids Search by a list of file IDs. (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) - * @param \DateTime|null $created_at Search files by time of creation. (optional) - * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) - * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) - * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) - * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) - * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte Search files by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search files by greater than or equal to ID. Can be used with idLte to create a range. (optional) + * @param \DateTime|null $created_at Search files by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search files by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for files containing the given name. (optional) * @param string|null $path Search files by path. (optional) - * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param int|null $size Search files by exact file size in bytes. (optional) - * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) - * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with sizeGte to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with sizeLte to create a range. (optional) * @param int|null $height Search files by height of image or video. (optional) - * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) - * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with heightGte to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with heightLte to create a range. (optional) * @param int|null $width Search files by width of image or video. (optional) - * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) - * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with widthGte to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with widthLte to create a range. (optional) * @param string|null $encoding Search files by specified encoding. (optional) - * @param string|null $type Filter by provided file type. (optional) + * @param string|null $type Search files by file type. (optional) * @param string|null $extension Search files by given extension. (optional) - * @param string|null $url Search by file URL. (optional) - * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) - * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) - * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param string|null $url Search for given URL (optional) + * @param bool|null $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If 'true' will show only public files; if 'false' will show only private files (optional) + * @param string|null $file_md5 Search files by specific md5 hash. (optional) * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) - * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) - * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with expiresAtGte to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with expiresAtLte to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1092,61 +1036,21 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\CollectionResponseFile' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\CollectionResponseFile' !== '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\Files\Model\CollectionResponseFile', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\CollectionResponseFile', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1160,34 +1064,11 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before ); } - $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFile'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\CollectionResponseFile', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1197,7 +1078,7 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1205,8 +1086,10 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1216,42 +1099,42 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before * * Search files * - * @param string[]|null $properties A list of file properties to return. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string[]|null $properties Desired file properties in the return object. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search files updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort files by a given field. (optional) - * @param int[]|null $ids Search by a list of file IDs. (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) - * @param \DateTime|null $created_at Search files by time of creation. (optional) - * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) - * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) - * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) - * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) - * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte Search files by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search files by greater than or equal to ID. Can be used with idLte to create a range. (optional) + * @param \DateTime|null $created_at Search files by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search files by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for files containing the given name. (optional) * @param string|null $path Search files by path. (optional) - * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param int|null $size Search files by exact file size in bytes. (optional) - * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) - * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with sizeGte to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with sizeLte to create a range. (optional) * @param int|null $height Search files by height of image or video. (optional) - * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) - * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with heightGte to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with heightLte to create a range. (optional) * @param int|null $width Search files by width of image or video. (optional) - * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) - * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with widthGte to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with widthLte to create a range. (optional) * @param string|null $encoding Search files by specified encoding. (optional) - * @param string|null $type Filter by provided file type. (optional) + * @param string|null $type Search files by file type. (optional) * @param string|null $extension Search files by given extension. (optional) - * @param string|null $url Search by file URL. (optional) - * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) - * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) - * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param string|null $url Search for given URL (optional) + * @param bool|null $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If 'true' will show only public files; if 'false' will show only private files (optional) + * @param string|null $file_md5 Search files by specific md5 hash. (optional) * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) - * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) - * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with expiresAtGte to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with expiresAtLte to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1272,42 +1155,42 @@ function ($response) { * * Search files * - * @param string[]|null $properties A list of file properties to return. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string[]|null $properties Desired file properties in the return object. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search files updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort files by a given field. (optional) - * @param int[]|null $ids Search by a list of file IDs. (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) - * @param \DateTime|null $created_at Search files by time of creation. (optional) - * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) - * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) - * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) - * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) - * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte Search files by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search files by greater than or equal to ID. Can be used with idLte to create a range. (optional) + * @param \DateTime|null $created_at Search files by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search files by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for files containing the given name. (optional) * @param string|null $path Search files by path. (optional) - * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param int|null $size Search files by exact file size in bytes. (optional) - * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) - * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with sizeGte to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with sizeLte to create a range. (optional) * @param int|null $height Search files by height of image or video. (optional) - * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) - * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with heightGte to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with heightLte to create a range. (optional) * @param int|null $width Search files by width of image or video. (optional) - * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) - * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with widthGte to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with widthLte to create a range. (optional) * @param string|null $encoding Search files by specified encoding. (optional) - * @param string|null $type Filter by provided file type. (optional) + * @param string|null $type Search files by file type. (optional) * @param string|null $extension Search files by given extension. (optional) - * @param string|null $url Search by file URL. (optional) - * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) - * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) - * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param string|null $url Search for given URL (optional) + * @param bool|null $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If 'true' will show only public files; if 'false' will show only private files (optional) + * @param string|null $file_md5 Search files by specific md5 hash. (optional) * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) - * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) - * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with expiresAtGte to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with expiresAtLte to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1357,42 +1240,42 @@ function ($exception) { /** * Create request for operation 'doSearch' * - * @param string[]|null $properties A list of file properties to return. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string[]|null $properties Desired file properties in the return object. (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search files updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort files by a given field. (optional) - * @param int[]|null $ids Search by a list of file IDs. (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) - * @param \DateTime|null $created_at Search files by time of creation. (optional) - * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with `createdAtGte` to create a range. (optional) - * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with `createdAtLte` to create a range. (optional) - * @param \DateTime|null $updated_at Search files by time of latest updated. (optional) - * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with `updatedAtGte` to create a range. (optional) - * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with `updatedAtLte` to create a range. (optional) + * @param int[]|null $ids (optional) + * @param int|null $id_lte Search files by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search files by greater than or equal to ID. Can be used with idLte to create a range. (optional) + * @param \DateTime|null $created_at Search files by exact time of creation. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $created_at_lte Search files by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) + * @param \DateTime|null $created_at_gte Search files by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) + * @param \DateTime|null $updated_at Search files by exact time of latest updated. Time must be epoch time in milliseconds. (optional) + * @param \DateTime|null $updated_at_lte Search files by less than or equal to time of latest update. Can be used with updatedAtGte to create a range. (optional) + * @param \DateTime|null $updated_at_gte Search files by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for files containing the given name. (optional) * @param string|null $path Search files by path. (optional) - * @param int[]|null $parent_folder_ids Search files within given `folderId`. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param int|null $size Search files by exact file size in bytes. (optional) - * @param int|null $size_lte Search files by less than or equal to file size. Can be used with `sizeGte` to create a range. (optional) - * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with `sizeLte` to create a range. (optional) + * @param int|null $size_lte Search files by less than or equal to file size. Can be used with sizeGte to create a range. (optional) + * @param int|null $size_gte Search files by greater than or equal to file size. Can be used with sizeLte to create a range. (optional) * @param int|null $height Search files by height of image or video. (optional) - * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with `heightGte` to create a range. (optional) - * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with `heightLte` to create a range. (optional) + * @param int|null $height_lte Search files by less than or equal to height of image or video. Can be used with heightGte to create a range. (optional) + * @param int|null $height_gte Search files by greater than or equal to height of image or video. Can be used with heightLte to create a range. (optional) * @param int|null $width Search files by width of image or video. (optional) - * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with `widthGte` to create a range. (optional) - * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with `widthLte` to create a range. (optional) + * @param int|null $width_lte Search files by less than or equal to width of image or video. Can be used with widthGte to create a range. (optional) + * @param int|null $width_gte Search files by greater than or equal to width of image or video. Can be used with widthLte to create a range. (optional) * @param string|null $encoding Search files by specified encoding. (optional) - * @param string|null $type Filter by provided file type. (optional) + * @param string|null $type Search files by file type. (optional) * @param string|null $extension Search files by given extension. (optional) - * @param string|null $url Search by file URL. (optional) - * @param bool|null $is_usable_in_content If `true`, shows files that have been marked to be used in new content. If `false`, shows files that should not be used in new content. (optional) - * @param bool|null $allows_anonymous_access Search files by access. If `true`, will show only public files. If `false`, will show only private files. (optional) - * @param string|null $file_md5 Search files by a specific md5 hash. (optional) + * @param string|null $url Search for given URL (optional) + * @param bool|null $is_usable_in_content If true shows files that have been marked to be used in new content. It false shows files that should not be used in new content. (optional) + * @param bool|null $allows_anonymous_access Search files by access. If 'true' will show only public files; if 'false' will show only private files (optional) + * @param string|null $file_md5 Search files by specific md5 hash. (optional) * @param \DateTime|null $expires_at Search files by exact expires time. Time must be epoch time in milliseconds. (optional) - * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with `expiresAtGte` to create a range. (optional) - * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with `expiresAtLte` to create a range. (optional) + * @param \DateTime|null $expires_at_lte Search files by less than or equal to expires time. Can be used with expiresAtGte to create a range. (optional) + * @param \DateTime|null $expires_at_gte Search files by greater than or equal to expires time. Can be used with expiresAtLte to create a range. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1836,7 +1719,7 @@ public function doSearchRequest($properties = null, $after = null, $before = nul * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[]|null $properties null (optional) + * @param string[]|null $properties (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\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1855,7 +1738,7 @@ public function getById($file_id, $properties = null, string $contentType = self * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[]|null $properties null (optional) + * @param string[]|null $properties (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\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1891,61 +1774,21 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\File' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\File' !== '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\Files\Model\File', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1959,34 +1802,11 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten ); } - $returnType = '\HubSpot\Client\Files\Model\File'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1996,7 +1816,7 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2004,8 +1824,10 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -2016,7 +1838,7 @@ public function getByIdWithHttpInfo($file_id, $properties = null, string $conten * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[]|null $properties null (optional) + * @param string[]|null $properties (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 @@ -2038,7 +1860,7 @@ function ($response) { * Retrieve file by ID * * @param string $file_id ID of the desired file. (required) - * @param string[]|null $properties null (optional) + * @param string[]|null $properties (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 @@ -2089,7 +1911,7 @@ function ($exception) { * Create request for operation 'getById' * * @param string $file_id ID of the desired file. (required) - * @param string[]|null $properties null (optional) + * @param string[]|null $properties (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 @@ -2200,8 +2022,8 @@ public function getByIdRequest($file_id, $properties = null, string $contentType * * Retrieve file by path * - * @param string $path The path of the file. (required) - * @param string[]|null $properties Properties to return in the response. (optional) + * @param string $path (required) + * @param string[]|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2219,8 +2041,8 @@ public function getMetadata($path, $properties = null, string $contentType = sel * * Retrieve file by path * - * @param string $path The path of the file. (required) - * @param string[]|null $properties Properties to return in the response. (optional) + * @param string $path (required) + * @param string[]|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -2256,61 +2078,21 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\FileStat' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FileStat' !== '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\Files\Model\FileStat', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FileStat', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2324,34 +2106,11 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte ); } - $returnType = '\HubSpot\Client\Files\Model\FileStat'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FileStat', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -2361,7 +2120,7 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2369,8 +2128,10 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -2380,8 +2141,8 @@ public function getMetadataWithHttpInfo($path, $properties = null, string $conte * * Retrieve file by path * - * @param string $path The path of the file. (required) - * @param string[]|null $properties Properties to return in the response. (optional) + * @param string $path (required) + * @param string[]|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2402,8 +2163,8 @@ function ($response) { * * Retrieve file by path * - * @param string $path The path of the file. (required) - * @param string[]|null $properties Properties to return in the response. (optional) + * @param string $path (required) + * @param string[]|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2453,8 +2214,8 @@ function ($exception) { /** * Create request for operation 'getMetadata' * - * @param string $path The path of the file. (required) - * @param string[]|null $properties Properties to return in the response. (optional) + * @param string $path (required) + * @param string[]|null $properties (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMetadata'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -2625,61 +2386,21 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\SignedUrl' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\SignedUrl' !== '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\Files\Model\SignedUrl', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\SignedUrl', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2693,34 +2414,11 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec ); } - $returnType = '\HubSpot\Client\Files\Model\SignedUrl'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\SignedUrl', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -2730,7 +2428,7 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2738,8 +2436,10 @@ public function getSignedUrlWithHttpInfo($file_id, $size = null, $expiration_sec $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -3014,61 +2714,21 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten switch($statusCode) { case 202: - if ('\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator' !== '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\Files\Model\ImportFromUrlTaskLocator', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -3082,34 +2742,11 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten ); } - $returnType = '\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\ImportFromUrlTaskLocator', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 202: @@ -3119,7 +2756,7 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3127,8 +2764,10 @@ public function importFromUrlWithHttpInfo($import_from_url_input, string $conten $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -3307,8 +2946,8 @@ public function importFromUrlRequest($import_from_url_input, string $contentType * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $charset_hunch Character set of given file data. (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * @@ -3316,9 +2955,9 @@ public function importFromUrlRequest($import_from_url_input, string $contentType * @throws \InvalidArgumentException * @return \HubSpot\Client\Files\Model\File|\HubSpot\Client\Files\Model\Error */ - public function replace($file_id, $file = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['replace'][0]) + public function replace($file_id, $charset_hunch = null, $file = null, $options = null, string $contentType = self::contentTypes['replace'][0]) { - list($response) = $this->replaceWithHttpInfo($file_id, $file, $charset_hunch, $options, $contentType); + list($response) = $this->replaceWithHttpInfo($file_id, $charset_hunch, $file, $options, $contentType); return $response; } @@ -3328,8 +2967,8 @@ public function replace($file_id, $file = null, $charset_hunch = null, $options * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $charset_hunch Character set of given file data. (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * @@ -3337,9 +2976,9 @@ public function replace($file_id, $file = null, $charset_hunch = null, $options * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Files\Model\File|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['replace'][0]) + public function replaceWithHttpInfo($file_id, $charset_hunch = null, $file = null, $options = null, string $contentType = self::contentTypes['replace'][0]) { - $request = $this->replaceRequest($file_id, $file, $charset_hunch, $options, $contentType); + $request = $this->replaceRequest($file_id, $charset_hunch, $file, $options, $contentType); try { $options = $this->createHttpClientOption(); @@ -3366,61 +3005,21 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\File' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\File' !== '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\Files\Model\File', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -3434,34 +3033,11 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul ); } - $returnType = '\HubSpot\Client\Files\Model\File'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -3471,7 +3047,7 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3479,8 +3055,10 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -3491,17 +3069,17 @@ public function replaceWithHttpInfo($file_id, $file = null, $charset_hunch = nul * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $charset_hunch Character set of given file data. (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function replaceAsync($file_id, $file = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['replace'][0]) + public function replaceAsync($file_id, $charset_hunch = null, $file = null, $options = null, string $contentType = self::contentTypes['replace'][0]) { - return $this->replaceAsyncWithHttpInfo($file_id, $file, $charset_hunch, $options, $contentType) + return $this->replaceAsyncWithHttpInfo($file_id, $charset_hunch, $file, $options, $contentType) ->then( function ($response) { return $response[0]; @@ -3515,18 +3093,18 @@ function ($response) { * Replace file * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $charset_hunch Character set of given file data. (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function replaceAsyncWithHttpInfo($file_id, $file = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['replace'][0]) + public function replaceAsyncWithHttpInfo($file_id, $charset_hunch = null, $file = null, $options = null, string $contentType = self::contentTypes['replace'][0]) { $returnType = '\HubSpot\Client\Files\Model\File'; - $request = $this->replaceRequest($file_id, $file, $charset_hunch, $options, $contentType); + $request = $this->replaceRequest($file_id, $charset_hunch, $file, $options, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3568,15 +3146,15 @@ function ($exception) { * Create request for operation 'replace' * * @param string $file_id ID of the desired file. (required) - * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $charset_hunch Character set of given file data. (optional) + * @param \SplFileObject|null $file File data that will replace existing file in the file manager. (optional) * @param string|null $options JSON string representing FileReplaceOptions. Includes options to set the access and expiresAt properties, which will automatically update when the file is replaced. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replace'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function replaceRequest($file_id, $file = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['replace'][0]) + public function replaceRequest($file_id, $charset_hunch = null, $file = null, $options = null, string $contentType = self::contentTypes['replace'][0]) { // verify the required parameter 'file_id' is set @@ -3612,25 +3190,16 @@ public function replaceRequest($file_id, $file = null, $charset_hunch = null, $o } // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue($paramFile), - 'rb' - ); - } - } - // form params - if ($charset_hunch !== null) { - $formParams['charsetHunch'] = ObjectSerializer::toFormValue($charset_hunch); - } - // form params - if ($options !== null) { - $formParams['options'] = ObjectSerializer::toFormValue($options); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'charset_hunch' => $charset_hunch, + 'file' => $file, + 'options' => $options, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $multipart = true; $headers = $this->headerSelector->selectHeaders( @@ -3751,61 +3320,21 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\File' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\File' !== '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\Files\Model\File', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -3819,34 +3348,11 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin ); } - $returnType = '\HubSpot\Client\Files\Model\File'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -3856,7 +3362,7 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3864,8 +3370,10 @@ public function updatePropertiesWithHttpInfo($file_id, $file_update_input, strin $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -4064,11 +3572,11 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co * * Upload file * + * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string|null $file_name Desired name for the uploaded file. (optional) - * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * @@ -4076,9 +3584,9 @@ public function updatePropertiesRequest($file_id, $file_update_input, string $co * @throws \InvalidArgumentException * @return \HubSpot\Client\Files\Model\File|\HubSpot\Client\Files\Model\Error */ - public function upload($file = null, $folder_id = null, $folder_path = null, $file_name = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['upload'][0]) + public function upload($charset_hunch = null, $file = null, $file_name = null, $folder_id = null, $folder_path = null, $options = null, string $contentType = self::contentTypes['upload'][0]) { - list($response) = $this->uploadWithHttpInfo($file, $folder_id, $folder_path, $file_name, $charset_hunch, $options, $contentType); + list($response) = $this->uploadWithHttpInfo($charset_hunch, $file, $file_name, $folder_id, $folder_path, $options, $contentType); return $response; } @@ -4087,11 +3595,11 @@ public function upload($file = null, $folder_id = null, $folder_path = null, $fi * * Upload file * + * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string|null $file_name Desired name for the uploaded file. (optional) - * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * @@ -4099,9 +3607,9 @@ public function upload($file = null, $folder_id = null, $folder_path = null, $fi * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Files\Model\File|\HubSpot\Client\Files\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path = null, $file_name = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['upload'][0]) + public function uploadWithHttpInfo($charset_hunch = null, $file = null, $file_name = null, $folder_id = null, $folder_path = null, $options = null, string $contentType = self::contentTypes['upload'][0]) { - $request = $this->uploadRequest($file, $folder_id, $folder_path, $file_name, $charset_hunch, $options, $contentType); + $request = $this->uploadRequest($charset_hunch, $file, $file_name, $folder_id, $folder_path, $options, $contentType); try { $options = $this->createHttpClientOption(); @@ -4128,61 +3636,21 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path switch($statusCode) { case 201: - if ('\HubSpot\Client\Files\Model\File' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\File' !== '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\Files\Model\File', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -4196,34 +3664,11 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path ); } - $returnType = '\HubSpot\Client\Files\Model\File'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\File', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -4233,7 +3678,7 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -4241,8 +3686,10 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -4252,20 +3699,20 @@ public function uploadWithHttpInfo($file = null, $folder_id = null, $folder_path * * Upload file * + * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string|null $file_name Desired name for the uploaded file. (optional) - * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function uploadAsync($file = null, $folder_id = null, $folder_path = null, $file_name = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['upload'][0]) + public function uploadAsync($charset_hunch = null, $file = null, $file_name = null, $folder_id = null, $folder_path = null, $options = null, string $contentType = self::contentTypes['upload'][0]) { - return $this->uploadAsyncWithHttpInfo($file, $folder_id, $folder_path, $file_name, $charset_hunch, $options, $contentType) + return $this->uploadAsyncWithHttpInfo($charset_hunch, $file, $file_name, $folder_id, $folder_path, $options, $contentType) ->then( function ($response) { return $response[0]; @@ -4278,21 +3725,21 @@ function ($response) { * * Upload file * + * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string|null $file_name Desired name for the uploaded file. (optional) - * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function uploadAsyncWithHttpInfo($file = null, $folder_id = null, $folder_path = null, $file_name = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['upload'][0]) + public function uploadAsyncWithHttpInfo($charset_hunch = null, $file = null, $file_name = null, $folder_id = null, $folder_path = null, $options = null, string $contentType = self::contentTypes['upload'][0]) { $returnType = '\HubSpot\Client\Files\Model\File'; - $request = $this->uploadRequest($file, $folder_id, $folder_path, $file_name, $charset_hunch, $options, $contentType); + $request = $this->uploadRequest($charset_hunch, $file, $file_name, $folder_id, $folder_path, $options, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4333,18 +3780,18 @@ function ($exception) { /** * Create request for operation 'upload' * + * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param \SplFileObject|null $file File to be uploaded. (optional) + * @param string|null $file_name Desired name for the uploaded file. (optional) * @param string|null $folder_id Either 'folderId' or 'folderPath' is required. folderId is the ID of the folder the file will be uploaded to. (optional) * @param string|null $folder_path Either 'folderPath' or 'folderId' is required. This field represents the destination folder path for the uploaded file. If a path doesn't exist, the system will try to create one. (optional) - * @param string|null $file_name Desired name for the uploaded file. (optional) - * @param string|null $charset_hunch Character set of the uploaded file. (optional) * @param string|null $options JSON string representing FileUploadOptions. (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['upload'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function uploadRequest($file = null, $folder_id = null, $folder_path = null, $file_name = null, $charset_hunch = null, $options = null, string $contentType = self::contentTypes['upload'][0]) + public function uploadRequest($charset_hunch = null, $file = null, $file_name = null, $folder_id = null, $folder_path = null, $options = null, string $contentType = self::contentTypes['upload'][0]) { @@ -4365,37 +3812,19 @@ public function uploadRequest($file = null, $folder_id = null, $folder_path = nu // form params - if ($file !== null) { - $multipart = true; - $formParams['file'] = []; - $paramFiles = is_array($file) ? $file : [$file]; - foreach ($paramFiles as $paramFile) { - $formParams['file'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue($paramFile), - 'rb' - ); - } - } - // form params - if ($folder_id !== null) { - $formParams['folderId'] = ObjectSerializer::toFormValue($folder_id); - } - // form params - if ($folder_path !== null) { - $formParams['folderPath'] = ObjectSerializer::toFormValue($folder_path); - } - // form params - if ($file_name !== null) { - $formParams['fileName'] = ObjectSerializer::toFormValue($file_name); - } - // form params - if ($charset_hunch !== null) { - $formParams['charsetHunch'] = ObjectSerializer::toFormValue($charset_hunch); - } - // form params - if ($options !== null) { - $formParams['options'] = ObjectSerializer::toFormValue($options); - } + $formDataProcessor = new FormDataProcessor(); + + $formData = $formDataProcessor->prepare([ + 'charset_hunch' => $charset_hunch, + 'file' => $file, + 'file_name' => $file_name, + 'folder_id' => $folder_id, + 'folder_path' => $folder_path, + 'options' => $options, + ]); + + $formParams = $formDataProcessor->flatten($formData); + $multipart = $formDataProcessor->has_file; $multipart = true; $headers = $this->headerSelector->selectHeaders( @@ -4471,6 +3900,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Files/Api/FoldersApi.php b/codegen/Files/Api/FoldersApi.php index 4778eedd..e3d3454a 100644 --- a/codegen/Files/Api/FoldersApi.php +++ b/codegen/Files/Api/FoldersApi.php @@ -1,7 +1,7 @@ getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -213,8 +215,10 @@ public function archiveWithHttpInfo($folder_id, string $contentType = self::cont $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -435,7 +439,6 @@ public function archiveByPathWithHttpInfo($folder_path, string $contentType = se return [null, $statusCode, $response->getHeaders()]; - } catch (ApiException $e) { switch ($e->getCode()) { default: @@ -445,8 +448,10 @@ public function archiveByPathWithHttpInfo($folder_path, string $contentType = se $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -615,7 +620,7 @@ public function archiveByPathRequest($folder_path, string $contentType = self::c * * Check folder update status * - * @param string $task_id The ID of the folder update task. (required) + * @param string $task_id TaskId of folder update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -633,7 +638,7 @@ public function checkUpdateStatus($task_id, string $contentType = self::contentT * * Check folder update status * - * @param string $task_id The ID of the folder update task. (required) + * @param string $task_id TaskId of folder update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -669,61 +674,21 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\FolderActionResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FolderActionResponse' !== '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\Files\Model\FolderActionResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FolderActionResponse', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -737,34 +702,11 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se ); } - $returnType = '\HubSpot\Client\Files\Model\FolderActionResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FolderActionResponse', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -774,7 +716,7 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -782,8 +724,10 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -793,7 +737,7 @@ public function checkUpdateStatusWithHttpInfo($task_id, string $contentType = se * * Check folder update status * - * @param string $task_id The ID of the folder update task. (required) + * @param string $task_id TaskId of folder update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -814,7 +758,7 @@ function ($response) { * * Check folder update status * - * @param string $task_id The ID of the folder update task. (required) + * @param string $task_id TaskId of folder update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -864,7 +808,7 @@ function ($exception) { /** * Create request for operation 'checkUpdateStatus' * - * @param string $task_id The ID of the folder update task. (required) + * @param string $task_id TaskId of folder update (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkUpdateStatus'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1016,61 +960,21 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co switch($statusCode) { case 201: - if ('\HubSpot\Client\Files\Model\Folder' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\Folder' !== '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\Files\Model\Folder', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1084,34 +988,11 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co ); } - $returnType = '\HubSpot\Client\Files\Model\Folder'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 201: @@ -1121,7 +1002,7 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1129,8 +1010,10 @@ public function createWithHttpInfo($folder_input, string $contentType = self::co $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1309,13 +1192,13 @@ public function createRequest($folder_input, string $contentType = self::content * Search folders * * @param string[]|null $properties Properties that should be included in the returned folders. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before before (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search folders updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param int[]|null $ids (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) + * @param int[]|null $ids Search folders by multiple IDs. Comma-separated list of folder IDs. (optional) + * @param int|null $id_lte Search folders by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search folders by greater than or equal to ID. Can be used with idLte to create a range. (optional) * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) @@ -1324,7 +1207,7 @@ public function createRequest($folder_input, string $contentType = self::content * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for folders containing the specified name. (optional) * @param string|null $path Search folders by path. (optional) - * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1343,13 +1226,13 @@ public function doSearch($properties = null, $after = null, $before = null, $lim * Search folders * * @param string[]|null $properties Properties that should be included in the returned folders. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search folders updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param int[]|null $ids (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) + * @param int[]|null $ids Search folders by multiple IDs. Comma-separated list of folder IDs. (optional) + * @param int|null $id_lte Search folders by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search folders by greater than or equal to ID. Can be used with idLte to create a range. (optional) * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) @@ -1358,7 +1241,7 @@ public function doSearch($properties = null, $after = null, $before = null, $lim * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for folders containing the specified name. (optional) * @param string|null $path Search folders by path. (optional) - * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \HubSpot\Client\Files\ApiException on non-2xx response or if the response body is not in the expected format @@ -1394,61 +1277,21 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\CollectionResponseFolder' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\CollectionResponseFolder' !== '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\Files\Model\CollectionResponseFolder', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\CollectionResponseFolder', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -1462,34 +1305,11 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before ); } - $returnType = '\HubSpot\Client\Files\Model\CollectionResponseFolder'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\CollectionResponseFolder', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -1499,7 +1319,7 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -1507,8 +1327,10 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -1519,13 +1341,13 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before * Search folders * * @param string[]|null $properties Properties that should be included in the returned folders. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search folders updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param int[]|null $ids (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) + * @param int[]|null $ids Search folders by multiple IDs. Comma-separated list of folder IDs. (optional) + * @param int|null $id_lte Search folders by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search folders by greater than or equal to ID. Can be used with idLte to create a range. (optional) * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) @@ -1534,7 +1356,7 @@ public function doSearchWithHttpInfo($properties = null, $after = null, $before * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for folders containing the specified name. (optional) * @param string|null $path Search folders by path. (optional) - * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1556,13 +1378,13 @@ function ($response) { * Search folders * * @param string[]|null $properties Properties that should be included in the returned folders. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search folders updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param int[]|null $ids (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) + * @param int[]|null $ids Search folders by multiple IDs. Comma-separated list of folder IDs. (optional) + * @param int|null $id_lte Search folders by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search folders by greater than or equal to ID. Can be used with idLte to create a range. (optional) * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) @@ -1571,7 +1393,7 @@ function ($response) { * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for folders containing the specified name. (optional) * @param string|null $path Search folders by path. (optional) - * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1622,13 +1444,13 @@ function ($exception) { * Create request for operation 'doSearch' * * @param string[]|null $properties Properties that should be included in the returned folders. (optional) - * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) - * @param string|null $before (optional) + * @param string|null $after Offset search results by this value. The default offset is 0 and the maximum offset of items for a given search is 10,000. Narrow your search down if you are reaching this limit. (optional) + * @param string|null $before Search folders updated before this timestamp. Time must be epoch time in milliseconds. (optional) * @param int|null $limit Number of items to return. Default limit is 10, maximum limit is 100. (optional) * @param string[]|null $sort Sort results by given property. For example -name sorts by name field descending, name sorts by name field ascending. (optional) - * @param int[]|null $ids (optional) - * @param int|null $id_lte (optional) - * @param int|null $id_gte (optional) + * @param int[]|null $ids Search folders by multiple IDs. Comma-separated list of folder IDs. (optional) + * @param int|null $id_lte Search folders by less than or equal to ID. Can be used with idGte to create a range. (optional) + * @param int|null $id_gte Search folders by greater than or equal to ID. Can be used with idLte to create a range. (optional) * @param \DateTime|null $created_at Search folders by exact time of creation. Time must be epoch time in milliseconds. (optional) * @param \DateTime|null $created_at_lte Search folders by less than or equal to time of creation. Can be used with createdAtGte to create a range. (optional) * @param \DateTime|null $created_at_gte Search folders by greater than or equal to time of creation. Can be used with createdAtLte to create a range. (optional) @@ -1637,7 +1459,7 @@ function ($exception) { * @param \DateTime|null $updated_at_gte Search folders by greater than or equal to time of latest update. Can be used with updatedAtLte to create a range. (optional) * @param string|null $name Search for folders containing the specified name. (optional) * @param string|null $path Search folders by path. (optional) - * @param int[]|null $parent_folder_ids Search folders with the given parent folderId. (optional) + * @param int[]|null $parent_folder_ids (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['doSearch'] to see the possible values for this operation * * @throws \InvalidArgumentException @@ -1946,61 +1768,21 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\Folder' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\Folder' !== '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\Files\Model\Folder', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2014,34 +1796,11 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont ); } - $returnType = '\HubSpot\Client\Files\Model\Folder'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -2051,7 +1810,7 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2059,8 +1818,10 @@ public function getByIdWithHttpInfo($folder_id, $properties = null, string $cont $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -2311,61 +2072,21 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\Folder' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\Folder' !== '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\Files\Model\Folder', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2379,34 +2100,11 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ ); } - $returnType = '\HubSpot\Client\Files\Model\Folder'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -2416,7 +2114,7 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2424,8 +2122,10 @@ public function getByPathWithHttpInfo($folder_path, $properties = null, string $ $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -2676,61 +2376,21 @@ public function updatePropertiesWithHttpInfo($folder_id, $folder_update_input, s switch($statusCode) { case 200: - if ('\HubSpot\Client\Files\Model\Folder' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\Folder' !== '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\Files\Model\Folder', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -2744,34 +2404,11 @@ public function updatePropertiesWithHttpInfo($folder_id, $folder_update_input, s ); } - $returnType = '\HubSpot\Client\Files\Model\Folder'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Folder', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 200: @@ -2781,7 +2418,7 @@ public function updatePropertiesWithHttpInfo($folder_id, $folder_update_input, s $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2789,8 +2426,10 @@ public function updatePropertiesWithHttpInfo($folder_id, $folder_update_input, s $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -3043,61 +2682,21 @@ public function updatePropertiesRecursivelyWithHttpInfo($folder_update_input_wit switch($statusCode) { case 202: - if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\Model\FolderUpdateTaskLocator' !== '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\Files\Model\FolderUpdateTaskLocator', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator', + $request, + $response, + ); default: - if ('\HubSpot\Client\Files\Model\Error' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\HubSpot\Client\Files\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\Files\Model\Error', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\Error', + $request, + $response, + ); } + + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( sprintf( @@ -3111,34 +2710,11 @@ public function updatePropertiesRecursivelyWithHttpInfo($folder_update_input_wit ); } - $returnType = '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - + return $this->handleResponseWithDataType( + '\HubSpot\Client\Files\Model\FolderUpdateTaskLocator', + $request, + $response, + ); } catch (ApiException $e) { switch ($e->getCode()) { case 202: @@ -3148,7 +2724,7 @@ public function updatePropertiesRecursivelyWithHttpInfo($folder_update_input_wit $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3156,8 +2732,10 @@ public function updatePropertiesRecursivelyWithHttpInfo($folder_update_input_wit $e->getResponseHeaders() ); $e->setResponseObject($data); - break; + throw $e; } + + throw $e; } } @@ -3346,6 +2924,57 @@ protected function createHttpClientOption() } } + if ($this->config->getCertFile()) { + $options[RequestOptions::CERT] = $this->config->getCertFile(); + } + + if ($this->config->getKeyFile()) { + $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile(); + } + return $options; } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response + ): array { + if ($dataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } } diff --git a/codegen/Files/ApiException.php b/codegen/Files/ApiException.php index 6501552a..88772273 100644 --- a/codegen/Files/ApiException.php +++ b/codegen/Files/ApiException.php @@ -1,7 +1,7 @@ tempFolderPath; } + /** + * Sets the certificate file path, for mTLS + * + * @return $this + */ + public function setCertFile($certFile) + { + $this->certFile = $certFile; + return $this; + } + + /** + * Gets the certificate file path, for mTLS + * + * @return string Certificate file path + */ + public function getCertFile() + { + return $this->certFile; + } + + /** + * Sets the certificate key path, for mTLS + * + * @return $this + */ + public function setKeyFile($keyFile) + { + $this->keyFile = $keyFile; + return $this; + } + + /** + * Gets the certificate key path, for mTLS + * + * @return string Certificate key path + */ + public function getKeyFile() + { + return $this->keyFile; + } + + /** * Gets the default configuration instance * diff --git a/codegen/Files/FormDataProcessor.php b/codegen/Files/FormDataProcessor.php new file mode 100644 index 00000000..7d41eb90 --- /dev/null +++ b/codegen/Files/FormDataProcessor.php @@ -0,0 +1,246 @@ + $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix.$key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + */ + protected function makeFormSafe($value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || (is_object($value) && !$value instanceof \DateTimeInterface)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (strpos($type, '\SplFileObject') !== false) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/codegen/Files/HeaderSelector.php b/codegen/Files/HeaderSelector.php index c5e26598..b0a29297 100644 --- a/codegen/Files/HeaderSelector.php +++ b/codegen/Files/HeaderSelector.php @@ -1,7 +1,7 @@ container[$offset]); } @@ -368,12 +368,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -398,11 +398,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/CollectionResponseFolder.php b/codegen/Files/Model/CollectionResponseFolder.php index f28ef54d..f1745599 100644 --- a/codegen/Files/Model/CollectionResponseFolder.php +++ b/codegen/Files/Model/CollectionResponseFolder.php @@ -2,7 +2,7 @@ /** * CollectionResponseFolder * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -339,7 +339,7 @@ public function getResults() /** * Sets results * - * @param \HubSpot\Client\Files\Model\Folder[] $results + * @param \HubSpot\Client\Files\Model\Folder[] $results results * * @return self */ @@ -355,11 +355,11 @@ public function setResults($results) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -367,12 +367,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +397,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/Error.php b/codegen/Files/Model/Error.php index f4a23547..3356cb8f 100644 --- a/codegen/Files/Model/Error.php +++ b/codegen/Files/Model/Error.php @@ -2,7 +2,7 @@ /** * Error * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,13 +57,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', + 'category' => 'string', 'context' => 'array', 'correlation_id' => 'string', + 'errors' => '\HubSpot\Client\Files\Model\ErrorDetail[]', 'links' => 'array', 'message' => 'string', - 'category' => 'string', - 'errors' => '\HubSpot\Client\Files\Model\ErrorDetail[]' + 'sub_category' => 'string' ]; /** @@ -74,13 +74,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, 'correlation_id' => 'uuid', + 'errors' => null, 'links' => null, 'message' => null, - 'category' => null, - 'errors' => null + 'sub_category' => null ]; /** @@ -89,13 +89,13 @@ class Error implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, 'correlation_id' => false, + 'errors' => false, 'links' => false, 'message' => false, - 'category' => false, - 'errors' => false + 'sub_category' => false ]; /** @@ -184,13 +184,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', 'correlation_id' => 'correlationId', + 'errors' => 'errors', 'links' => 'links', 'message' => 'message', - 'category' => 'category', - 'errors' => 'errors' + 'sub_category' => 'subCategory' ]; /** @@ -199,13 +199,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', 'correlation_id' => 'setCorrelationId', + 'errors' => 'setErrors', 'links' => 'setLinks', 'message' => 'setMessage', - 'category' => 'setCategory', - 'errors' => 'setErrors' + 'sub_category' => 'setSubCategory' ]; /** @@ -214,13 +214,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', 'correlation_id' => 'getCorrelationId', + 'errors' => 'getErrors', 'links' => 'getLinks', 'message' => 'getMessage', - 'category' => 'getCategory', - 'errors' => 'getErrors' + 'sub_category' => 'getSubCategory' ]; /** @@ -280,13 +280,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); $this->setIfExists('correlation_id', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -316,15 +316,15 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['correlation_id'] === null) { $invalidProperties[] = "'correlation_id' can't be null"; } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } return $invalidProperties; } @@ -341,28 +341,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return string|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string $category The error category * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -421,6 +421,33 @@ public function setCorrelationId($correlation_id) return $this; } + /** + * Gets errors + * + * @return \HubSpot\Client\Files\Model\ErrorDetail[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \HubSpot\Client\Files\Model\ErrorDetail[]|null $errors further information about the error + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** * Gets links * @@ -476,66 +503,39 @@ public function setMessage($message) } /** - * Gets category - * - * @return string - */ - public function getCategory() - { - return $this->container['category']; - } - - /** - * Sets category - * - * @param string $category The error category - * - * @return self - */ - public function setCategory($category) - { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); - } - $this->container['category'] = $category; - - return $this; - } - - /** - * Gets errors + * Gets sub_category * - * @return \HubSpot\Client\Files\Model\ErrorDetail[]|null + * @return string|null */ - public function getErrors() + public function getSubCategory() { - return $this->container['errors']; + return $this->container['sub_category']; } /** - * Sets errors + * Sets sub_category * - * @param \HubSpot\Client\Files\Model\ErrorDetail[]|null $errors further information about the error + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setErrors($errors) + public function setSubCategory($sub_category) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['errors'] = $errors; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -543,12 +543,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -573,11 +573,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/ErrorDetail.php b/codegen/Files/Model/ErrorDetail.php index 673e5d1d..8ec24b39 100644 --- a/codegen/Files/Model/ErrorDetail.php +++ b/codegen/Files/Model/ErrorDetail.php @@ -2,7 +2,7 @@ /** * ErrorDetail * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,11 +57,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'string', 'code' => 'string', - 'in' => 'string', 'context' => 'array', - 'message' => 'string' + 'in' => 'string', + 'message' => 'string', + 'sub_category' => 'string' ]; /** @@ -72,11 +72,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, 'code' => null, - 'in' => null, 'context' => null, - 'message' => null + 'in' => null, + 'message' => null, + 'sub_category' => null ]; /** @@ -85,11 +85,11 @@ class ErrorDetail implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, 'code' => false, - 'in' => false, 'context' => false, - 'message' => false + 'in' => false, + 'message' => false, + 'sub_category' => false ]; /** @@ -178,11 +178,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', 'code' => 'code', - 'in' => 'in', 'context' => 'context', - 'message' => 'message' + 'in' => 'in', + 'message' => 'message', + 'sub_category' => 'subCategory' ]; /** @@ -191,11 +191,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', 'code' => 'setCode', - 'in' => 'setIn', 'context' => 'setContext', - 'message' => 'setMessage' + 'in' => 'setIn', + 'message' => 'setMessage', + 'sub_category' => 'setSubCategory' ]; /** @@ -204,11 +204,11 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', 'code' => 'getCode', - 'in' => 'getIn', 'context' => 'getContext', - 'message' => 'getMessage' + 'in' => 'getIn', + 'message' => 'getMessage', + 'sub_category' => 'getSubCategory' ]; /** @@ -268,11 +268,11 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('in', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -321,55 +321,55 @@ public function valid() /** - * Gets sub_category + * Gets code * * @return string|null */ - public function getSubCategory() + public function getCode() { - return $this->container['sub_category']; + return $this->container['code']; } /** - * Sets sub_category + * Sets code * - * @param string|null $sub_category A specific category that contains more specific detail about the error + * @param string|null $code The status code associated with the error detail * * @return self */ - public function setSubCategory($sub_category) + public function setCode($code) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['code'] = $code; return $this; } /** - * Gets code + * Gets context * - * @return string|null + * @return array|null */ - public function getCode() + public function getContext() { - return $this->container['code']; + return $this->container['context']; } /** - * Sets code + * Sets context * - * @param string|null $code The status code associated with the error detail + * @param array|null $context Context about the error condition * * @return self */ - public function setCode($code) + public function setContext($context) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); + if (is_null($context)) { + throw new \InvalidArgumentException('non-nullable context cannot be null'); } - $this->container['code'] = $code; + $this->container['context'] = $context; return $this; } @@ -402,66 +402,66 @@ public function setIn($in) } /** - * Gets context + * Gets message * - * @return array|null + * @return string */ - public function getContext() + public function getMessage() { - return $this->container['context']; + return $this->container['message']; } /** - * Sets context + * Sets message * - * @param array|null $context Context about the error condition + * @param string $message A human readable message describing the error along with remediation steps where appropriate * * @return self */ - public function setContext($context) + public function setMessage($message) { - if (is_null($context)) { - throw new \InvalidArgumentException('non-nullable context cannot be null'); + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['context'] = $context; + $this->container['message'] = $message; return $this; } /** - * Gets message + * Gets sub_category * - * @return string + * @return string|null */ - public function getMessage() + public function getSubCategory() { - return $this->container['message']; + return $this->container['sub_category']; } /** - * Sets message + * Sets sub_category * - * @param string $message A human readable message describing the error along with remediation steps where appropriate + * @param string|null $sub_category A specific category that contains more specific detail about the error * * @return self */ - public function setMessage($message) + public function setSubCategory($sub_category) { - if (is_null($message)) { - throw new \InvalidArgumentException('non-nullable message cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['message'] = $message; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -469,12 +469,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -499,11 +499,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/File.php b/codegen/Files/Model/File.php index 915866c2..53e119e4 100644 --- a/codegen/Files/Model/File.php +++ b/codegen/Files/Model/File.php @@ -2,7 +2,7 @@ /** * File * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,27 +58,27 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'extension' => 'string', 'access' => 'string', - 'parent_folder_id' => 'string', - 'source_group' => 'string', - 'file_md5' => 'string', + 'archived' => 'bool', + 'archived_at' => '\DateTime', + 'created_at' => '\DateTime', + 'default_hosting_url' => 'string', 'encoding' => 'string', - 'type' => 'string', - 'is_usable_in_content' => 'bool', - 'url' => 'string', 'expires_at' => 'int', - 'created_at' => '\DateTime', - 'archived_at' => '\DateTime', + 'extension' => 'string', + 'file_md5' => 'string', + 'height' => 'int', + 'id' => 'string', + 'is_usable_in_content' => 'bool', + 'name' => 'string', + 'parent_folder_id' => 'string', 'path' => 'string', - 'archived' => 'bool', 'size' => 'int', - 'name' => 'string', - 'width' => 'int', - 'id' => 'string', - 'default_hosting_url' => 'string', + 'source_group' => 'string', + 'type' => 'string', 'updated_at' => '\DateTime', - 'height' => 'int' + 'url' => 'string', + 'width' => 'int' ]; /** @@ -89,27 +89,27 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'extension' => null, 'access' => null, - 'parent_folder_id' => null, - 'source_group' => null, - 'file_md5' => null, + 'archived' => null, + 'archived_at' => 'date-time', + 'created_at' => 'date-time', + 'default_hosting_url' => null, 'encoding' => null, - 'type' => null, - 'is_usable_in_content' => null, - 'url' => null, 'expires_at' => 'int64', - 'created_at' => 'date-time', - 'archived_at' => 'date-time', + 'extension' => null, + 'file_md5' => null, + 'height' => 'int32', + 'id' => null, + 'is_usable_in_content' => null, + 'name' => null, + 'parent_folder_id' => null, 'path' => null, - 'archived' => null, 'size' => 'int64', - 'name' => null, - 'width' => 'int32', - 'id' => null, - 'default_hosting_url' => null, + 'source_group' => null, + 'type' => null, 'updated_at' => 'date-time', - 'height' => 'int32' + 'url' => null, + 'width' => 'int32' ]; /** @@ -118,27 +118,27 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'extension' => false, 'access' => false, - 'parent_folder_id' => false, - 'source_group' => false, - 'file_md5' => false, + 'archived' => false, + 'archived_at' => false, + 'created_at' => false, + 'default_hosting_url' => false, 'encoding' => false, - 'type' => false, - 'is_usable_in_content' => false, - 'url' => false, 'expires_at' => false, - 'created_at' => false, - 'archived_at' => false, + 'extension' => false, + 'file_md5' => false, + 'height' => false, + 'id' => false, + 'is_usable_in_content' => false, + 'name' => false, + 'parent_folder_id' => false, 'path' => false, - 'archived' => false, 'size' => false, - 'name' => false, - 'width' => false, - 'id' => false, - 'default_hosting_url' => false, + 'source_group' => false, + 'type' => false, 'updated_at' => false, - 'height' => false + 'url' => false, + 'width' => false ]; /** @@ -227,27 +227,27 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'extension' => 'extension', 'access' => 'access', - 'parent_folder_id' => 'parentFolderId', - 'source_group' => 'sourceGroup', - 'file_md5' => 'fileMd5', + 'archived' => 'archived', + 'archived_at' => 'archivedAt', + 'created_at' => 'createdAt', + 'default_hosting_url' => 'defaultHostingUrl', 'encoding' => 'encoding', - 'type' => 'type', - 'is_usable_in_content' => 'isUsableInContent', - 'url' => 'url', 'expires_at' => 'expiresAt', - 'created_at' => 'createdAt', - 'archived_at' => 'archivedAt', + 'extension' => 'extension', + 'file_md5' => 'fileMd5', + 'height' => 'height', + 'id' => 'id', + 'is_usable_in_content' => 'isUsableInContent', + 'name' => 'name', + 'parent_folder_id' => 'parentFolderId', 'path' => 'path', - 'archived' => 'archived', 'size' => 'size', - 'name' => 'name', - 'width' => 'width', - 'id' => 'id', - 'default_hosting_url' => 'defaultHostingUrl', + 'source_group' => 'sourceGroup', + 'type' => 'type', 'updated_at' => 'updatedAt', - 'height' => 'height' + 'url' => 'url', + 'width' => 'width' ]; /** @@ -256,27 +256,27 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'extension' => 'setExtension', 'access' => 'setAccess', - 'parent_folder_id' => 'setParentFolderId', - 'source_group' => 'setSourceGroup', - 'file_md5' => 'setFileMd5', + 'archived' => 'setArchived', + 'archived_at' => 'setArchivedAt', + 'created_at' => 'setCreatedAt', + 'default_hosting_url' => 'setDefaultHostingUrl', 'encoding' => 'setEncoding', - 'type' => 'setType', - 'is_usable_in_content' => 'setIsUsableInContent', - 'url' => 'setUrl', 'expires_at' => 'setExpiresAt', - 'created_at' => 'setCreatedAt', - 'archived_at' => 'setArchivedAt', + 'extension' => 'setExtension', + 'file_md5' => 'setFileMd5', + 'height' => 'setHeight', + 'id' => 'setId', + 'is_usable_in_content' => 'setIsUsableInContent', + 'name' => 'setName', + 'parent_folder_id' => 'setParentFolderId', 'path' => 'setPath', - 'archived' => 'setArchived', 'size' => 'setSize', - 'name' => 'setName', - 'width' => 'setWidth', - 'id' => 'setId', - 'default_hosting_url' => 'setDefaultHostingUrl', + 'source_group' => 'setSourceGroup', + 'type' => 'setType', 'updated_at' => 'setUpdatedAt', - 'height' => 'setHeight' + 'url' => 'setUrl', + 'width' => 'setWidth' ]; /** @@ -285,27 +285,27 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'extension' => 'getExtension', 'access' => 'getAccess', - 'parent_folder_id' => 'getParentFolderId', - 'source_group' => 'getSourceGroup', - 'file_md5' => 'getFileMd5', + 'archived' => 'getArchived', + 'archived_at' => 'getArchivedAt', + 'created_at' => 'getCreatedAt', + 'default_hosting_url' => 'getDefaultHostingUrl', 'encoding' => 'getEncoding', - 'type' => 'getType', - 'is_usable_in_content' => 'getIsUsableInContent', - 'url' => 'getUrl', 'expires_at' => 'getExpiresAt', - 'created_at' => 'getCreatedAt', - 'archived_at' => 'getArchivedAt', + 'extension' => 'getExtension', + 'file_md5' => 'getFileMd5', + 'height' => 'getHeight', + 'id' => 'getId', + 'is_usable_in_content' => 'getIsUsableInContent', + 'name' => 'getName', + 'parent_folder_id' => 'getParentFolderId', 'path' => 'getPath', - 'archived' => 'getArchived', 'size' => 'getSize', - 'name' => 'getName', - 'width' => 'getWidth', - 'id' => 'getId', - 'default_hosting_url' => 'getDefaultHostingUrl', + 'source_group' => 'getSourceGroup', + 'type' => 'getType', 'updated_at' => 'getUpdatedAt', - 'height' => 'getHeight' + 'url' => 'getUrl', + 'width' => 'getWidth' ]; /** @@ -349,14 +349,19 @@ public function getModelName() return self::$openAPIModelName; } - public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; - public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_HIDDEN_INDEXABLE = 'HIDDEN_INDEXABLE'; public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; - public const ACCESS__PRIVATE = 'PRIVATE'; public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; + public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_SENSITIVE = 'SENSITIVE'; + public const SOURCE_GROUP_CONTENT = 'CONTENT'; + public const SOURCE_GROUP_CONVERSATIONS = 'CONVERSATIONS'; + public const SOURCE_GROUP_FORMS = 'FORMS'; + public const SOURCE_GROUP_UI_EXTENSIONS = 'UI_EXTENSIONS'; + public const SOURCE_GROUP_UNKNOWN = 'UNKNOWN'; /** * Gets allowable values of the enum @@ -366,17 +371,33 @@ public function getModelName() public function getAccessAllowableValues() { return [ - self::ACCESS_PUBLIC_INDEXABLE, - self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_HIDDEN_INDEXABLE, self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, - self::ACCESS__PRIVATE, self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS__PRIVATE, + self::ACCESS_PUBLIC_INDEXABLE, + self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_SENSITIVE, ]; } + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getSourceGroupAllowableValues() + { + return [ + self::SOURCE_GROUP_CONTENT, + self::SOURCE_GROUP_CONVERSATIONS, + self::SOURCE_GROUP_FORMS, + self::SOURCE_GROUP_UI_EXTENSIONS, + self::SOURCE_GROUP_UNKNOWN, + ]; + } + /** * Associative array for storing property values * @@ -392,27 +413,27 @@ public function getAccessAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('extension', $data ?? [], null); $this->setIfExists('access', $data ?? [], null); - $this->setIfExists('parent_folder_id', $data ?? [], null); - $this->setIfExists('source_group', $data ?? [], null); - $this->setIfExists('file_md5', $data ?? [], null); + $this->setIfExists('archived', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('default_hosting_url', $data ?? [], null); $this->setIfExists('encoding', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('is_usable_in_content', $data ?? [], null); - $this->setIfExists('url', $data ?? [], null); $this->setIfExists('expires_at', $data ?? [], null); - $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('extension', $data ?? [], null); + $this->setIfExists('file_md5', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('is_usable_in_content', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('path', $data ?? [], null); - $this->setIfExists('archived', $data ?? [], null); $this->setIfExists('size', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('width', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('default_hosting_url', $data ?? [], null); + $this->setIfExists('source_group', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); - $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); } /** @@ -454,15 +475,24 @@ public function listInvalidProperties() ); } - if ($this->container['created_at'] === null) { - $invalidProperties[] = "'created_at' can't be null"; - } if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } + $allowedValues = $this->getSourceGroupAllowableValues(); + if (!is_null($this->container['source_group']) && !in_array($this->container['source_group'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'source_group', must be one of '%s'", + $this->container['source_group'], + implode("', '", $allowedValues) + ); + } + if ($this->container['updated_at'] === null) { $invalidProperties[] = "'updated_at' can't be null"; } @@ -481,33 +511,6 @@ public function valid() } - /** - * Gets extension - * - * @return string|null - */ - public function getExtension() - { - return $this->container['extension']; - } - - /** - * Sets extension - * - * @param string|null $extension Extension of the file. ex: .jpg, .png, .gif, .pdf, etc. - * - * @return self - */ - public function setExtension($extension) - { - if (is_null($extension)) { - throw new \InvalidArgumentException('non-nullable extension cannot be null'); - } - $this->container['extension'] = $extension; - - return $this; - } - /** * Gets access * @@ -521,7 +524,7 @@ public function getAccess() /** * Sets access * - * @param string $access File access. Can be PUBLIC_INDEXABLE, PUBLIC_NOT_INDEXABLE, PRIVATE. + * @param string $access PUBLIC_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines can index the file. PUBLIC_NOT_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines *can't* index the file. PRIVATE: File is NOT publicly accessible. Requires a signed URL to see content. Search engines *can't* index the file. * * @return self */ @@ -546,460 +549,470 @@ public function setAccess($access) } /** - * Gets parent_folder_id + * Gets archived * - * @return string|null + * @return bool */ - public function getParentFolderId() + public function getArchived() { - return $this->container['parent_folder_id']; + return $this->container['archived']; } /** - * Sets parent_folder_id + * Sets archived * - * @param string|null $parent_folder_id ID of the folder the file is in. + * @param bool $archived Marks whether the folder is deleted or not. * * @return self */ - public function setParentFolderId($parent_folder_id) + public function setArchived($archived) { - if (is_null($parent_folder_id)) { - throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['parent_folder_id'] = $parent_folder_id; + $this->container['archived'] = $archived; return $this; } /** - * Gets source_group + * Gets archived_at * - * @return string|null + * @return \DateTime|null */ - public function getSourceGroup() + public function getArchivedAt() { - return $this->container['source_group']; + return $this->container['archived_at']; } /** - * Sets source_group + * Sets archived_at * - * @param string|null $source_group source_group + * @param \DateTime|null $archived_at Timestamp of folder deletion. * * @return self */ - public function setSourceGroup($source_group) + public function setArchivedAt($archived_at) { - if (is_null($source_group)) { - throw new \InvalidArgumentException('non-nullable source_group cannot be null'); + if (is_null($archived_at)) { + throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); } - $this->container['source_group'] = $source_group; + $this->container['archived_at'] = $archived_at; return $this; } /** - * Gets file_md5 + * Gets created_at * - * @return string|null + * @return \DateTime */ - public function getFileMd5() + public function getCreatedAt() { - return $this->container['file_md5']; + return $this->container['created_at']; } /** - * Sets file_md5 + * Sets created_at * - * @param string|null $file_md5 file_md5 + * @param \DateTime $created_at Timestamp of folder creation. * * @return self */ - public function setFileMd5($file_md5) + public function setCreatedAt($created_at) { - if (is_null($file_md5)) { - throw new \InvalidArgumentException('non-nullable file_md5 cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['file_md5'] = $file_md5; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets encoding + * Gets default_hosting_url * * @return string|null */ - public function getEncoding() + public function getDefaultHostingUrl() { - return $this->container['encoding']; + return $this->container['default_hosting_url']; } /** - * Sets encoding + * Sets default_hosting_url * - * @param string|null $encoding Encoding of the file. + * @param string|null $default_hosting_url Default hosting URL of the file. This will use one of HubSpot's provided URLs to serve the file. * * @return self */ - public function setEncoding($encoding) + public function setDefaultHostingUrl($default_hosting_url) { - if (is_null($encoding)) { - throw new \InvalidArgumentException('non-nullable encoding cannot be null'); + if (is_null($default_hosting_url)) { + throw new \InvalidArgumentException('non-nullable default_hosting_url cannot be null'); } - $this->container['encoding'] = $encoding; + $this->container['default_hosting_url'] = $default_hosting_url; return $this; } /** - * Gets type + * Gets encoding * * @return string|null */ - public function getType() + public function getEncoding() { - return $this->container['type']; + return $this->container['encoding']; } /** - * Sets type + * Sets encoding * - * @param string|null $type Type of the file. Can be IMG, DOCUMENT, AUDIO, MOVIE, or OTHER. + * @param string|null $encoding Encoding of the file. * * @return self */ - public function setType($type) + public function setEncoding($encoding) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); + if (is_null($encoding)) { + throw new \InvalidArgumentException('non-nullable encoding cannot be null'); } - $this->container['type'] = $type; + $this->container['encoding'] = $encoding; return $this; } /** - * Gets is_usable_in_content + * Gets expires_at * - * @return bool|null + * @return int|null */ - public function getIsUsableInContent() + public function getExpiresAt() { - return $this->container['is_usable_in_content']; + return $this->container['expires_at']; } /** - * Sets is_usable_in_content + * Sets expires_at * - * @param bool|null $is_usable_in_content Previously \"archied\". Indicates if the file should be used when creating new content like web pages. + * @param int|null $expires_at expires_at * * @return self */ - public function setIsUsableInContent($is_usable_in_content) + public function setExpiresAt($expires_at) { - if (is_null($is_usable_in_content)) { - throw new \InvalidArgumentException('non-nullable is_usable_in_content cannot be null'); + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); } - $this->container['is_usable_in_content'] = $is_usable_in_content; + $this->container['expires_at'] = $expires_at; return $this; } /** - * Gets url + * Gets extension * * @return string|null */ - public function getUrl() + public function getExtension() { - return $this->container['url']; + return $this->container['extension']; } /** - * Sets url + * Sets extension * - * @param string|null $url URL of the given file. This URL can change depending on the domain settings of the account. Will use the select file hosting domain. + * @param string|null $extension Extension of the requested file. * * @return self */ - public function setUrl($url) + public function setExtension($extension) { - if (is_null($url)) { - throw new \InvalidArgumentException('non-nullable url cannot be null'); + if (is_null($extension)) { + throw new \InvalidArgumentException('non-nullable extension cannot be null'); } - $this->container['url'] = $url; + $this->container['extension'] = $extension; return $this; } /** - * Gets expires_at + * Gets file_md5 * - * @return int|null + * @return string|null */ - public function getExpiresAt() + public function getFileMd5() { - return $this->container['expires_at']; + return $this->container['file_md5']; } /** - * Sets expires_at + * Sets file_md5 * - * @param int|null $expires_at expires_at + * @param string|null $file_md5 The MD5 hash of the file. * * @return self */ - public function setExpiresAt($expires_at) + public function setFileMd5($file_md5) { - if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + if (is_null($file_md5)) { + throw new \InvalidArgumentException('non-nullable file_md5 cannot be null'); } - $this->container['expires_at'] = $expires_at; + $this->container['file_md5'] = $file_md5; return $this; } /** - * Gets created_at + * Gets height * - * @return \DateTime + * @return int|null */ - public function getCreatedAt() + public function getHeight() { - return $this->container['created_at']; + return $this->container['height']; } /** - * Sets created_at + * Sets height * - * @param \DateTime $created_at Creation time of the file object. + * @param int|null $height For image and video files. The height of the file. * * @return self */ - public function setCreatedAt($created_at) + public function setHeight($height) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['height'] = $height; return $this; } /** - * Gets archived_at + * Gets id * - * @return \DateTime|null + * @return string */ - public function getArchivedAt() + public function getId() { - return $this->container['archived_at']; + return $this->container['id']; } /** - * Sets archived_at + * Sets id * - * @param \DateTime|null $archived_at Deletion time of the file object. + * @param string $id File ID. * * @return self */ - public function setArchivedAt($archived_at) + public function setId($id) { - if (is_null($archived_at)) { - throw new \InvalidArgumentException('non-nullable archived_at cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['archived_at'] = $archived_at; + $this->container['id'] = $id; return $this; } /** - * Gets path + * Gets is_usable_in_content * - * @return string|null + * @return bool|null */ - public function getPath() + public function getIsUsableInContent() { - return $this->container['path']; + return $this->container['is_usable_in_content']; } /** - * Sets path + * Sets is_usable_in_content * - * @param string|null $path Path of the file in the file manager. + * @param bool|null $is_usable_in_content Mark whether the file should be used in new content or not. * * @return self */ - public function setPath($path) + public function setIsUsableInContent($is_usable_in_content) { - if (is_null($path)) { - throw new \InvalidArgumentException('non-nullable path cannot be null'); + if (is_null($is_usable_in_content)) { + throw new \InvalidArgumentException('non-nullable is_usable_in_content cannot be null'); } - $this->container['path'] = $path; + $this->container['is_usable_in_content'] = $is_usable_in_content; return $this; } /** - * Gets archived + * Gets name * - * @return bool + * @return string|null */ - public function getArchived() + public function getName() { - return $this->container['archived']; + return $this->container['name']; } /** - * Sets archived + * Sets name * - * @param bool $archived If the file is deleted. + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ - public function setArchived($archived) + public function setName($name) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['archived'] = $archived; + $this->container['name'] = $name; return $this; } /** - * Gets size + * Gets parent_folder_id * - * @return int|null + * @return string|null */ - public function getSize() + public function getParentFolderId() { - return $this->container['size']; + return $this->container['parent_folder_id']; } /** - * Sets size + * Sets parent_folder_id * - * @param int|null $size Size of the file in bytes. + * @param string|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ - public function setSize($size) + public function setParentFolderId($parent_folder_id) { - if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); } - $this->container['size'] = $size; + $this->container['parent_folder_id'] = $parent_folder_id; return $this; } /** - * Gets name + * Gets path * * @return string|null */ - public function getName() + public function getPath() { - return $this->container['name']; + return $this->container['path']; } /** - * Sets name + * Sets path * - * @param string|null $name Name of the file. + * @param string|null $path Path of the folder in the file manager. * * @return self */ - public function setName($name) + public function setPath($path) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); } - $this->container['name'] = $name; + $this->container['path'] = $path; return $this; } /** - * Gets width + * Gets size * * @return int|null */ - public function getWidth() + public function getSize() { - return $this->container['width']; + return $this->container['size']; } /** - * Sets width + * Sets size * - * @param int|null $width For image and video files, the width of the content. + * @param int|null $size Size in bytes of the requested file. * * @return self */ - public function setWidth($width) + public function setSize($size) { - if (is_null($width)) { - throw new \InvalidArgumentException('non-nullable width cannot be null'); + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); } - $this->container['width'] = $width; + $this->container['size'] = $size; return $this; } /** - * Gets id + * Gets source_group * - * @return string + * @return string|null */ - public function getId() + public function getSourceGroup() { - return $this->container['id']; + return $this->container['source_group']; } /** - * Sets id + * Sets source_group * - * @param string $id File ID. + * @param string|null $source_group source_group * * @return self */ - public function setId($id) + public function setSourceGroup($source_group) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($source_group)) { + throw new \InvalidArgumentException('non-nullable source_group cannot be null'); } - $this->container['id'] = $id; + $allowedValues = $this->getSourceGroupAllowableValues(); + if (!in_array($source_group, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'source_group', must be one of '%s'", + $source_group, + implode("', '", $allowedValues) + ) + ); + } + $this->container['source_group'] = $source_group; return $this; } /** - * Gets default_hosting_url + * Gets type * * @return string|null */ - public function getDefaultHostingUrl() + public function getType() { - return $this->container['default_hosting_url']; + return $this->container['type']; } /** - * Sets default_hosting_url + * Sets type * - * @param string|null $default_hosting_url Default hosting URL of the file. This will use one of HubSpot's provided URLs to serve the file. + * @param string|null $type Type of the file. Can be IMG, DOCUMENT, AUDIO, MOVIE, or OTHER. * * @return self */ - public function setDefaultHostingUrl($default_hosting_url) + public function setType($type) { - if (is_null($default_hosting_url)) { - throw new \InvalidArgumentException('non-nullable default_hosting_url cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['default_hosting_url'] = $default_hosting_url; + $this->container['type'] = $type; return $this; } @@ -1017,7 +1030,7 @@ public function getUpdatedAt() /** * Sets updated_at * - * @param \DateTime $updated_at Timestamp of the latest update to the file. + * @param \DateTime $updated_at Timestamp of the latest update to the folder. * * @return self */ @@ -1032,39 +1045,66 @@ public function setUpdatedAt($updated_at) } /** - * Gets height + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL to download the new file from. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets width * * @return int|null */ - public function getHeight() + public function getWidth() { - return $this->container['height']; + return $this->container['width']; } /** - * Sets height + * Sets width * - * @param int|null $height For image and video files, the height of the content. + * @param int|null $width For image and video files. The width of the file. * * @return self */ - public function setHeight($height) + public function setWidth($width) { - if (is_null($height)) { - throw new \InvalidArgumentException('non-nullable height cannot be null'); + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); } - $this->container['height'] = $height; + $this->container['width'] = $width; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -1072,12 +1112,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -1102,11 +1142,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FileActionResponse.php b/codegen/Files/Model/FileActionResponse.php index 6f065bf1..81643144 100644 --- a/codegen/Files/Model/FileActionResponse.php +++ b/codegen/Files/Model/FileActionResponse.php @@ -2,7 +2,7 @@ /** * FileActionResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,15 +57,15 @@ class FileActionResponse implements ModelInterface, ArrayAccess, \JsonSerializab * @var string[] */ protected static $openAPITypes = [ - 'result' => '\HubSpot\Client\Files\Model\File', 'completed_at' => '\DateTime', + 'errors' => '\HubSpot\Client\Files\Model\StandardError[]', + 'links' => 'array', 'num_errors' => 'int', 'requested_at' => '\DateTime', + 'result' => '\HubSpot\Client\Files\Model\File', 'started_at' => '\DateTime', - 'links' => 'array', - 'errors' => '\HubSpot\Client\Files\Model\StandardError[]', - 'task_id' => 'string', - 'status' => 'string' + 'status' => 'string', + 'task_id' => 'string' ]; /** @@ -76,15 +76,15 @@ class FileActionResponse implements ModelInterface, ArrayAccess, \JsonSerializab * @psalm-var array */ protected static $openAPIFormats = [ - 'result' => null, 'completed_at' => 'date-time', + 'errors' => null, + 'links' => null, 'num_errors' => 'int32', 'requested_at' => 'date-time', + 'result' => null, 'started_at' => 'date-time', - 'links' => null, - 'errors' => null, - 'task_id' => null, - 'status' => null + 'status' => null, + 'task_id' => null ]; /** @@ -93,15 +93,15 @@ class FileActionResponse implements ModelInterface, ArrayAccess, \JsonSerializab * @var boolean[] */ protected static array $openAPINullables = [ - 'result' => false, 'completed_at' => false, + 'errors' => false, + 'links' => false, 'num_errors' => false, 'requested_at' => false, + 'result' => false, 'started_at' => false, - 'links' => false, - 'errors' => false, - 'task_id' => false, - 'status' => false + 'status' => false, + 'task_id' => false ]; /** @@ -190,15 +190,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'result' => 'result', 'completed_at' => 'completedAt', + 'errors' => 'errors', + 'links' => 'links', 'num_errors' => 'numErrors', 'requested_at' => 'requestedAt', + 'result' => 'result', 'started_at' => 'startedAt', - 'links' => 'links', - 'errors' => 'errors', - 'task_id' => 'taskId', - 'status' => 'status' + 'status' => 'status', + 'task_id' => 'taskId' ]; /** @@ -207,15 +207,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'result' => 'setResult', 'completed_at' => 'setCompletedAt', + 'errors' => 'setErrors', + 'links' => 'setLinks', 'num_errors' => 'setNumErrors', 'requested_at' => 'setRequestedAt', + 'result' => 'setResult', 'started_at' => 'setStartedAt', - 'links' => 'setLinks', - 'errors' => 'setErrors', - 'task_id' => 'setTaskId', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'task_id' => 'setTaskId' ]; /** @@ -224,15 +224,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'result' => 'getResult', 'completed_at' => 'getCompletedAt', + 'errors' => 'getErrors', + 'links' => 'getLinks', 'num_errors' => 'getNumErrors', 'requested_at' => 'getRequestedAt', + 'result' => 'getResult', 'started_at' => 'getStartedAt', - 'links' => 'getLinks', - 'errors' => 'getErrors', - 'task_id' => 'getTaskId', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'task_id' => 'getTaskId' ]; /** @@ -276,10 +276,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; public const STATUS_CANCELED = 'CANCELED'; public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; /** * Gets allowable values of the enum @@ -289,10 +289,10 @@ public function getModelName() public function getStatusAllowableValues() { return [ - self::STATUS_PENDING, - self::STATUS_PROCESSING, self::STATUS_CANCELED, self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, ]; } @@ -311,15 +311,15 @@ public function getStatusAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('result', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); $this->setIfExists('started_at', $data ?? [], null); - $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); - $this->setIfExists('task_id', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('task_id', $data ?? [], null); } /** @@ -355,9 +355,6 @@ public function listInvalidProperties() if ($this->container['started_at'] === null) { $invalidProperties[] = "'started_at' can't be null"; } - if ($this->container['task_id'] === null) { - $invalidProperties[] = "'task_id' can't be null"; - } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -370,6 +367,9 @@ public function listInvalidProperties() ); } + if ($this->container['task_id'] === null) { + $invalidProperties[] = "'task_id' can't be null"; + } return $invalidProperties; } @@ -385,33 +385,6 @@ public function valid() } - /** - * Gets result - * - * @return \HubSpot\Client\Files\Model\File|null - */ - public function getResult() - { - return $this->container['result']; - } - - /** - * Sets result - * - * @param \HubSpot\Client\Files\Model\File|null $result result - * - * @return self - */ - public function setResult($result) - { - if (is_null($result)) { - throw new \InvalidArgumentException('non-nullable result cannot be null'); - } - $this->container['result'] = $result; - - return $this; - } - /** * Gets completed_at * @@ -425,7 +398,7 @@ public function getCompletedAt() /** * Sets completed_at * - * @param \DateTime $completed_at Time of completion of task. + * @param \DateTime $completed_at When the requested changes have been completed. * * @return self */ @@ -440,163 +413,163 @@ public function setCompletedAt($completed_at) } /** - * Gets num_errors + * Gets errors * - * @return int|null + * @return \HubSpot\Client\Files\Model\StandardError[]|null */ - public function getNumErrors() + public function getErrors() { - return $this->container['num_errors']; + return $this->container['errors']; } /** - * Sets num_errors + * Sets errors * - * @param int|null $num_errors Number of errors resulting from the task. + * @param \HubSpot\Client\Files\Model\StandardError[]|null $errors Descriptive error messages. * * @return self */ - public function setNumErrors($num_errors) + public function setErrors($errors) { - if (is_null($num_errors)) { - throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['num_errors'] = $num_errors; + $this->container['errors'] = $errors; return $this; } /** - * Gets requested_at + * Gets links * - * @return \DateTime|null + * @return array|null */ - public function getRequestedAt() + public function getLinks() { - return $this->container['requested_at']; + return $this->container['links']; } /** - * Sets requested_at + * Sets links * - * @param \DateTime|null $requested_at Timestamp of when the task was requested. + * @param array|null $links Link to check the status of the requested task. * * @return self */ - public function setRequestedAt($requested_at) + public function setLinks($links) { - if (is_null($requested_at)) { - throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['requested_at'] = $requested_at; + $this->container['links'] = $links; return $this; } /** - * Gets started_at + * Gets num_errors * - * @return \DateTime + * @return int|null */ - public function getStartedAt() + public function getNumErrors() { - return $this->container['started_at']; + return $this->container['num_errors']; } /** - * Sets started_at + * Sets num_errors * - * @param \DateTime $started_at Timestamp of when the task was started. + * @param int|null $num_errors Number of errors resulting from the requested changes. * * @return self */ - public function setStartedAt($started_at) + public function setNumErrors($num_errors) { - if (is_null($started_at)) { - throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); } - $this->container['started_at'] = $started_at; + $this->container['num_errors'] = $num_errors; return $this; } /** - * Gets links + * Gets requested_at * - * @return array|null + * @return \DateTime|null */ - public function getLinks() + public function getRequestedAt() { - return $this->container['links']; + return $this->container['requested_at']; } /** - * Sets links + * Sets requested_at * - * @param array|null $links Link to check the status of the requested task. + * @param \DateTime|null $requested_at Timestamp representing when the task was requested. * * @return self */ - public function setLinks($links) + public function setRequestedAt($requested_at) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); } - $this->container['links'] = $links; + $this->container['requested_at'] = $requested_at; return $this; } /** - * Gets errors + * Gets result * - * @return \HubSpot\Client\Files\Model\StandardError[]|null + * @return \HubSpot\Client\Files\Model\File|null */ - public function getErrors() + public function getResult() { - return $this->container['errors']; + return $this->container['result']; } /** - * Sets errors + * Sets result * - * @param \HubSpot\Client\Files\Model\StandardError[]|null $errors Descriptive error messages. + * @param \HubSpot\Client\Files\Model\File|null $result result * * @return self */ - public function setErrors($errors) + public function setResult($result) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); } - $this->container['errors'] = $errors; + $this->container['result'] = $result; return $this; } /** - * Gets task_id + * Gets started_at * - * @return string + * @return \DateTime */ - public function getTaskId() + public function getStartedAt() { - return $this->container['task_id']; + return $this->container['started_at']; } /** - * Sets task_id + * Sets started_at * - * @param string $task_id ID of the requested task. + * @param \DateTime $started_at Timestamp representing when the task was started at. * * @return self */ - public function setTaskId($task_id) + public function setStartedAt($started_at) { - if (is_null($task_id)) { - throw new \InvalidArgumentException('non-nullable task_id cannot be null'); + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); } - $this->container['task_id'] = $task_id; + $this->container['started_at'] = $started_at; return $this; } @@ -637,14 +610,41 @@ public function setStatus($status) return $this; } + + /** + * Gets task_id + * + * @return string + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param string $task_id ID of the task. + * + * @return self + */ + public function setTaskId($task_id) + { + if (is_null($task_id)) { + throw new \InvalidArgumentException('non-nullable task_id cannot be null'); + } + $this->container['task_id'] = $task_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -652,12 +652,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -682,11 +682,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FileStat.php b/codegen/Files/Model/FileStat.php index 982faeb6..566245ab 100644 --- a/codegen/Files/Model/FileStat.php +++ b/codegen/Files/Model/FileStat.php @@ -2,7 +2,7 @@ /** * FileStat * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -352,11 +352,11 @@ public function setFolder($folder) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -364,12 +364,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -394,11 +394,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FileUpdateInput.php b/codegen/Files/Model/FileUpdateInput.php index 1cd78760..b0a38552 100644 --- a/codegen/Files/Model/FileUpdateInput.php +++ b/codegen/Files/Model/FileUpdateInput.php @@ -2,7 +2,7 @@ /** * FileUpdateInput * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -59,12 +59,12 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'access' => 'string', - 'parent_folder_id' => 'string', - 'name' => 'string', - 'parent_folder_path' => 'string', 'clear_expires' => 'bool', + 'expires_at' => '\DateTime', 'is_usable_in_content' => 'bool', - 'expires_at' => '\DateTime' + 'name' => 'string', + 'parent_folder_id' => 'string', + 'parent_folder_path' => 'string' ]; /** @@ -76,12 +76,12 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'access' => null, - 'parent_folder_id' => null, - 'name' => null, - 'parent_folder_path' => null, 'clear_expires' => null, + 'expires_at' => 'date-time', 'is_usable_in_content' => null, - 'expires_at' => 'date-time' + 'name' => null, + 'parent_folder_id' => null, + 'parent_folder_path' => null ]; /** @@ -91,12 +91,12 @@ class FileUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'access' => false, - 'parent_folder_id' => false, - 'name' => false, - 'parent_folder_path' => false, 'clear_expires' => false, + 'expires_at' => false, 'is_usable_in_content' => false, - 'expires_at' => false + 'name' => false, + 'parent_folder_id' => false, + 'parent_folder_path' => false ]; /** @@ -186,12 +186,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'access' => 'access', - 'parent_folder_id' => 'parentFolderId', - 'name' => 'name', - 'parent_folder_path' => 'parentFolderPath', 'clear_expires' => 'clearExpires', + 'expires_at' => 'expiresAt', 'is_usable_in_content' => 'isUsableInContent', - 'expires_at' => 'expiresAt' + 'name' => 'name', + 'parent_folder_id' => 'parentFolderId', + 'parent_folder_path' => 'parentFolderPath' ]; /** @@ -201,12 +201,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'access' => 'setAccess', - 'parent_folder_id' => 'setParentFolderId', - 'name' => 'setName', - 'parent_folder_path' => 'setParentFolderPath', 'clear_expires' => 'setClearExpires', + 'expires_at' => 'setExpiresAt', 'is_usable_in_content' => 'setIsUsableInContent', - 'expires_at' => 'setExpiresAt' + 'name' => 'setName', + 'parent_folder_id' => 'setParentFolderId', + 'parent_folder_path' => 'setParentFolderPath' ]; /** @@ -216,12 +216,12 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'access' => 'getAccess', - 'parent_folder_id' => 'getParentFolderId', - 'name' => 'getName', - 'parent_folder_path' => 'getParentFolderPath', 'clear_expires' => 'getClearExpires', + 'expires_at' => 'getExpiresAt', 'is_usable_in_content' => 'getIsUsableInContent', - 'expires_at' => 'getExpiresAt' + 'name' => 'getName', + 'parent_folder_id' => 'getParentFolderId', + 'parent_folder_path' => 'getParentFolderPath' ]; /** @@ -265,13 +265,13 @@ public function getModelName() return self::$openAPIModelName; } - public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; - public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_HIDDEN_INDEXABLE = 'HIDDEN_INDEXABLE'; public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; - public const ACCESS__PRIVATE = 'PRIVATE'; public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; + public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_SENSITIVE = 'SENSITIVE'; /** @@ -282,13 +282,13 @@ public function getModelName() public function getAccessAllowableValues() { return [ - self::ACCESS_PUBLIC_INDEXABLE, - self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_HIDDEN_INDEXABLE, self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, - self::ACCESS__PRIVATE, self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS__PRIVATE, + self::ACCESS_PUBLIC_INDEXABLE, + self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_SENSITIVE, ]; } @@ -309,12 +309,12 @@ public function getAccessAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('access', $data ?? [], null); - $this->setIfExists('parent_folder_id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('parent_folder_path', $data ?? [], null); $this->setIfExists('clear_expires', $data ?? [], null); - $this->setIfExists('is_usable_in_content', $data ?? [], null); $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('is_usable_in_content', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_folder_id', $data ?? [], null); + $this->setIfExists('parent_folder_path', $data ?? [], null); } /** @@ -381,7 +381,7 @@ public function getAccess() /** * Sets access * - * @param string|null $access NONE: Do not run any duplicate validation. REJECT: Reject the upload if a duplicate is found. RETURN_EXISTING: If a duplicate file is found, do not upload a new file and return the found duplicate instead. + * @param string|null $access PUBLIC_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines can index the file. PUBLIC_NOT_INDEXABLE: File is publicly accessible by anyone who has the URL. Search engines *can't* index the file. PRIVATE: File is NOT publicly accessible. Requires a signed URL to see content. Search engines *can't* index the file. * * @return self */ @@ -406,174 +406,174 @@ public function setAccess($access) } /** - * Gets parent_folder_id + * Gets clear_expires * - * @return string|null + * @return bool|null */ - public function getParentFolderId() + public function getClearExpires() { - return $this->container['parent_folder_id']; + return $this->container['clear_expires']; } /** - * Sets parent_folder_id + * Sets clear_expires * - * @param string|null $parent_folder_id FolderId where the file should be moved to. folderId and folderPath parameters cannot be set at the same time. + * @param bool|null $clear_expires clear_expires * * @return self */ - public function setParentFolderId($parent_folder_id) + public function setClearExpires($clear_expires) { - if (is_null($parent_folder_id)) { - throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + if (is_null($clear_expires)) { + throw new \InvalidArgumentException('non-nullable clear_expires cannot be null'); } - $this->container['parent_folder_id'] = $parent_folder_id; + $this->container['clear_expires'] = $clear_expires; return $this; } /** - * Gets name + * Gets expires_at * - * @return string|null + * @return \DateTime|null */ - public function getName() + public function getExpiresAt() { - return $this->container['name']; + return $this->container['expires_at']; } /** - * Sets name + * Sets expires_at * - * @param string|null $name New name for the file. + * @param \DateTime|null $expires_at expires_at * * @return self */ - public function setName($name) + public function setExpiresAt($expires_at) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); } - $this->container['name'] = $name; + $this->container['expires_at'] = $expires_at; return $this; } /** - * Gets parent_folder_path + * Gets is_usable_in_content * - * @return string|null + * @return bool|null */ - public function getParentFolderPath() + public function getIsUsableInContent() { - return $this->container['parent_folder_path']; + return $this->container['is_usable_in_content']; } /** - * Sets parent_folder_path + * Sets is_usable_in_content * - * @param string|null $parent_folder_path Folder path where the file should be moved to. folderId and folderPath parameters cannot be set at the same time. + * @param bool|null $is_usable_in_content Mark whether the file should be used in new content or not. * * @return self */ - public function setParentFolderPath($parent_folder_path) + public function setIsUsableInContent($is_usable_in_content) { - if (is_null($parent_folder_path)) { - throw new \InvalidArgumentException('non-nullable parent_folder_path cannot be null'); + if (is_null($is_usable_in_content)) { + throw new \InvalidArgumentException('non-nullable is_usable_in_content cannot be null'); } - $this->container['parent_folder_path'] = $parent_folder_path; + $this->container['is_usable_in_content'] = $is_usable_in_content; return $this; } /** - * Gets clear_expires + * Gets name * - * @return bool|null + * @return string|null */ - public function getClearExpires() + public function getName() { - return $this->container['clear_expires']; + return $this->container['name']; } /** - * Sets clear_expires + * Sets name * - * @param bool|null $clear_expires clear_expires + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ - public function setClearExpires($clear_expires) + public function setName($name) { - if (is_null($clear_expires)) { - throw new \InvalidArgumentException('non-nullable clear_expires cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['clear_expires'] = $clear_expires; + $this->container['name'] = $name; return $this; } /** - * Gets is_usable_in_content + * Gets parent_folder_id * - * @return bool|null + * @return string|null */ - public function getIsUsableInContent() + public function getParentFolderId() { - return $this->container['is_usable_in_content']; + return $this->container['parent_folder_id']; } /** - * Sets is_usable_in_content + * Sets parent_folder_id * - * @param bool|null $is_usable_in_content Mark whether the file should be used in new content or not. + * @param string|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ - public function setIsUsableInContent($is_usable_in_content) + public function setParentFolderId($parent_folder_id) { - if (is_null($is_usable_in_content)) { - throw new \InvalidArgumentException('non-nullable is_usable_in_content cannot be null'); + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); } - $this->container['is_usable_in_content'] = $is_usable_in_content; + $this->container['parent_folder_id'] = $parent_folder_id; return $this; } /** - * Gets expires_at + * Gets parent_folder_path * - * @return \DateTime|null + * @return string|null */ - public function getExpiresAt() + public function getParentFolderPath() { - return $this->container['expires_at']; + return $this->container['parent_folder_path']; } /** - * Sets expires_at + * Sets parent_folder_path * - * @param \DateTime|null $expires_at expires_at + * @param string|null $parent_folder_path Folder path where the file should be moved to. folderId and folderPath parameters cannot be set at the same time. * * @return self */ - public function setExpiresAt($expires_at) + public function setParentFolderPath($parent_folder_path) { - if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + if (is_null($parent_folder_path)) { + throw new \InvalidArgumentException('non-nullable parent_folder_path cannot be null'); } - $this->container['expires_at'] = $expires_at; + $this->container['parent_folder_path'] = $parent_folder_path; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -581,12 +581,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -611,11 +611,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/Folder.php b/codegen/Files/Model/Folder.php index a9867fd0..58126f09 100644 --- a/codegen/Files/Model/Folder.php +++ b/codegen/Files/Model/Folder.php @@ -2,7 +2,7 @@ /** * Folder * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,13 +57,13 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'created_at' => '\DateTime', - 'archived_at' => '\DateTime', - 'path' => 'string', 'archived' => 'bool', - 'parent_folder_id' => 'string', - 'name' => 'string', + 'archived_at' => '\DateTime', + 'created_at' => '\DateTime', 'id' => 'string', + 'name' => 'string', + 'parent_folder_id' => 'string', + 'path' => 'string', 'updated_at' => '\DateTime' ]; @@ -75,13 +75,13 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'created_at' => 'date-time', - 'archived_at' => 'date-time', - 'path' => null, 'archived' => null, - 'parent_folder_id' => null, - 'name' => null, + 'archived_at' => 'date-time', + 'created_at' => 'date-time', 'id' => null, + 'name' => null, + 'parent_folder_id' => null, + 'path' => null, 'updated_at' => 'date-time' ]; @@ -91,13 +91,13 @@ class Folder implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'created_at' => false, - 'archived_at' => false, - 'path' => false, 'archived' => false, - 'parent_folder_id' => false, - 'name' => false, + 'archived_at' => false, + 'created_at' => false, 'id' => false, + 'name' => false, + 'parent_folder_id' => false, + 'path' => false, 'updated_at' => false ]; @@ -187,13 +187,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'created_at' => 'createdAt', - 'archived_at' => 'archivedAt', - 'path' => 'path', 'archived' => 'archived', - 'parent_folder_id' => 'parentFolderId', - 'name' => 'name', + 'archived_at' => 'archivedAt', + 'created_at' => 'createdAt', 'id' => 'id', + 'name' => 'name', + 'parent_folder_id' => 'parentFolderId', + 'path' => 'path', 'updated_at' => 'updatedAt' ]; @@ -203,13 +203,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'created_at' => 'setCreatedAt', - 'archived_at' => 'setArchivedAt', - 'path' => 'setPath', 'archived' => 'setArchived', - 'parent_folder_id' => 'setParentFolderId', - 'name' => 'setName', + 'archived_at' => 'setArchivedAt', + 'created_at' => 'setCreatedAt', 'id' => 'setId', + 'name' => 'setName', + 'parent_folder_id' => 'setParentFolderId', + 'path' => 'setPath', 'updated_at' => 'setUpdatedAt' ]; @@ -219,13 +219,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'created_at' => 'getCreatedAt', - 'archived_at' => 'getArchivedAt', - 'path' => 'getPath', 'archived' => 'getArchived', - 'parent_folder_id' => 'getParentFolderId', - 'name' => 'getName', + 'archived_at' => 'getArchivedAt', + 'created_at' => 'getCreatedAt', 'id' => 'getId', + 'name' => 'getName', + 'parent_folder_id' => 'getParentFolderId', + 'path' => 'getPath', 'updated_at' => 'getUpdatedAt' ]; @@ -286,13 +286,13 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('created_at', $data ?? [], null); - $this->setIfExists('archived_at', $data ?? [], null); - $this->setIfExists('path', $data ?? [], null); $this->setIfExists('archived', $data ?? [], null); - $this->setIfExists('parent_folder_id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('archived_at', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_folder_id', $data ?? [], null); + $this->setIfExists('path', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -323,12 +323,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['created_at'] === null) { - $invalidProperties[] = "'created_at' can't be null"; - } if ($this->container['archived'] === null) { $invalidProperties[] = "'archived' can't be null"; } + if ($this->container['created_at'] === null) { + $invalidProperties[] = "'created_at' can't be null"; + } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } @@ -351,28 +351,28 @@ public function valid() /** - * Gets created_at + * Gets archived * - * @return \DateTime + * @return bool */ - public function getCreatedAt() + public function getArchived() { - return $this->container['created_at']; + return $this->container['archived']; } /** - * Sets created_at + * Sets archived * - * @param \DateTime $created_at Timestamp of folder creation. + * @param bool $archived Marks whether the folder is deleted or not. * * @return self */ - public function setCreatedAt($created_at) + public function setArchived($archived) { - if (is_null($created_at)) { - throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + if (is_null($archived)) { + throw new \InvalidArgumentException('non-nullable archived cannot be null'); } - $this->container['created_at'] = $created_at; + $this->container['archived'] = $archived; return $this; } @@ -405,136 +405,136 @@ public function setArchivedAt($archived_at) } /** - * Gets path + * Gets created_at * - * @return string|null + * @return \DateTime */ - public function getPath() + public function getCreatedAt() { - return $this->container['path']; + return $this->container['created_at']; } /** - * Sets path + * Sets created_at * - * @param string|null $path Path of the folder in the file manager. + * @param \DateTime $created_at Timestamp of folder creation. * * @return self */ - public function setPath($path) + public function setCreatedAt($created_at) { - if (is_null($path)) { - throw new \InvalidArgumentException('non-nullable path cannot be null'); + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); } - $this->container['path'] = $path; + $this->container['created_at'] = $created_at; return $this; } /** - * Gets archived + * Gets id * - * @return bool + * @return string */ - public function getArchived() + public function getId() { - return $this->container['archived']; + return $this->container['id']; } /** - * Sets archived + * Sets id * - * @param bool $archived Marks whether the folder is deleted or not. + * @param string $id ID of the folder. * * @return self */ - public function setArchived($archived) + public function setId($id) { - if (is_null($archived)) { - throw new \InvalidArgumentException('non-nullable archived cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['archived'] = $archived; + $this->container['id'] = $id; return $this; } /** - * Gets parent_folder_id + * Gets name * * @return string|null */ - public function getParentFolderId() + public function getName() { - return $this->container['parent_folder_id']; + return $this->container['name']; } /** - * Sets parent_folder_id + * Sets name * - * @param string|null $parent_folder_id ID of the parent folder. + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ - public function setParentFolderId($parent_folder_id) + public function setName($name) { - if (is_null($parent_folder_id)) { - throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['parent_folder_id'] = $parent_folder_id; + $this->container['name'] = $name; return $this; } /** - * Gets name + * Gets parent_folder_id * * @return string|null */ - public function getName() + public function getParentFolderId() { - return $this->container['name']; + return $this->container['parent_folder_id']; } /** - * Sets name + * Sets parent_folder_id * - * @param string|null $name Name of the folder. + * @param string|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ - public function setName($name) + public function setParentFolderId($parent_folder_id) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); } - $this->container['name'] = $name; + $this->container['parent_folder_id'] = $parent_folder_id; return $this; } /** - * Gets id + * Gets path * - * @return string + * @return string|null */ - public function getId() + public function getPath() { - return $this->container['id']; + return $this->container['path']; } /** - * Sets id + * Sets path * - * @param string $id ID of the folder. + * @param string|null $path Path of the folder in the file manager. * * @return self */ - public function setId($id) + public function setPath($path) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($path)) { + throw new \InvalidArgumentException('non-nullable path cannot be null'); } - $this->container['id'] = $id; + $this->container['path'] = $path; return $this; } @@ -568,11 +568,11 @@ public function setUpdatedAt($updated_at) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -580,12 +580,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -610,11 +610,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FolderActionResponse.php b/codegen/Files/Model/FolderActionResponse.php index 89b2d4f9..5aa60054 100644 --- a/codegen/Files/Model/FolderActionResponse.php +++ b/codegen/Files/Model/FolderActionResponse.php @@ -2,7 +2,7 @@ /** * FolderActionResponse * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,15 +57,15 @@ class FolderActionResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'result' => '\HubSpot\Client\Files\Model\Folder', 'completed_at' => '\DateTime', + 'errors' => '\HubSpot\Client\Files\Model\StandardError[]', + 'links' => 'array', 'num_errors' => 'int', 'requested_at' => '\DateTime', + 'result' => '\HubSpot\Client\Files\Model\Folder', 'started_at' => '\DateTime', - 'links' => 'array', - 'errors' => '\HubSpot\Client\Files\Model\StandardError[]', - 'task_id' => 'string', - 'status' => 'string' + 'status' => 'string', + 'task_id' => 'string' ]; /** @@ -76,15 +76,15 @@ class FolderActionResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @psalm-var array */ protected static $openAPIFormats = [ - 'result' => null, 'completed_at' => 'date-time', + 'errors' => null, + 'links' => null, 'num_errors' => 'int32', 'requested_at' => 'date-time', + 'result' => null, 'started_at' => 'date-time', - 'links' => null, - 'errors' => null, - 'task_id' => null, - 'status' => null + 'status' => null, + 'task_id' => null ]; /** @@ -93,15 +93,15 @@ class FolderActionResponse implements ModelInterface, ArrayAccess, \JsonSerializ * @var boolean[] */ protected static array $openAPINullables = [ - 'result' => false, 'completed_at' => false, + 'errors' => false, + 'links' => false, 'num_errors' => false, 'requested_at' => false, + 'result' => false, 'started_at' => false, - 'links' => false, - 'errors' => false, - 'task_id' => false, - 'status' => false + 'status' => false, + 'task_id' => false ]; /** @@ -190,15 +190,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'result' => 'result', 'completed_at' => 'completedAt', + 'errors' => 'errors', + 'links' => 'links', 'num_errors' => 'numErrors', 'requested_at' => 'requestedAt', + 'result' => 'result', 'started_at' => 'startedAt', - 'links' => 'links', - 'errors' => 'errors', - 'task_id' => 'taskId', - 'status' => 'status' + 'status' => 'status', + 'task_id' => 'taskId' ]; /** @@ -207,15 +207,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'result' => 'setResult', 'completed_at' => 'setCompletedAt', + 'errors' => 'setErrors', + 'links' => 'setLinks', 'num_errors' => 'setNumErrors', 'requested_at' => 'setRequestedAt', + 'result' => 'setResult', 'started_at' => 'setStartedAt', - 'links' => 'setLinks', - 'errors' => 'setErrors', - 'task_id' => 'setTaskId', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'task_id' => 'setTaskId' ]; /** @@ -224,15 +224,15 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'result' => 'getResult', 'completed_at' => 'getCompletedAt', + 'errors' => 'getErrors', + 'links' => 'getLinks', 'num_errors' => 'getNumErrors', 'requested_at' => 'getRequestedAt', + 'result' => 'getResult', 'started_at' => 'getStartedAt', - 'links' => 'getLinks', - 'errors' => 'getErrors', - 'task_id' => 'getTaskId', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'task_id' => 'getTaskId' ]; /** @@ -276,10 +276,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_PENDING = 'PENDING'; - public const STATUS_PROCESSING = 'PROCESSING'; public const STATUS_CANCELED = 'CANCELED'; public const STATUS_COMPLETE = 'COMPLETE'; + public const STATUS_PENDING = 'PENDING'; + public const STATUS_PROCESSING = 'PROCESSING'; /** * Gets allowable values of the enum @@ -289,10 +289,10 @@ public function getModelName() public function getStatusAllowableValues() { return [ - self::STATUS_PENDING, - self::STATUS_PROCESSING, self::STATUS_CANCELED, self::STATUS_COMPLETE, + self::STATUS_PENDING, + self::STATUS_PROCESSING, ]; } @@ -311,15 +311,15 @@ public function getStatusAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('result', $data ?? [], null); $this->setIfExists('completed_at', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); $this->setIfExists('num_errors', $data ?? [], null); $this->setIfExists('requested_at', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); $this->setIfExists('started_at', $data ?? [], null); - $this->setIfExists('links', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); - $this->setIfExists('task_id', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('task_id', $data ?? [], null); } /** @@ -355,9 +355,6 @@ public function listInvalidProperties() if ($this->container['started_at'] === null) { $invalidProperties[] = "'started_at' can't be null"; } - if ($this->container['task_id'] === null) { - $invalidProperties[] = "'task_id' can't be null"; - } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -370,6 +367,9 @@ public function listInvalidProperties() ); } + if ($this->container['task_id'] === null) { + $invalidProperties[] = "'task_id' can't be null"; + } return $invalidProperties; } @@ -385,33 +385,6 @@ public function valid() } - /** - * Gets result - * - * @return \HubSpot\Client\Files\Model\Folder|null - */ - public function getResult() - { - return $this->container['result']; - } - - /** - * Sets result - * - * @param \HubSpot\Client\Files\Model\Folder|null $result result - * - * @return self - */ - public function setResult($result) - { - if (is_null($result)) { - throw new \InvalidArgumentException('non-nullable result cannot be null'); - } - $this->container['result'] = $result; - - return $this; - } - /** * Gets completed_at * @@ -440,163 +413,163 @@ public function setCompletedAt($completed_at) } /** - * Gets num_errors + * Gets errors * - * @return int|null + * @return \HubSpot\Client\Files\Model\StandardError[]|null */ - public function getNumErrors() + public function getErrors() { - return $this->container['num_errors']; + return $this->container['errors']; } /** - * Sets num_errors + * Sets errors * - * @param int|null $num_errors Number of errors resulting from the requested changes. + * @param \HubSpot\Client\Files\Model\StandardError[]|null $errors Detailed errors resulting from the task. * * @return self */ - public function setNumErrors($num_errors) + public function setErrors($errors) { - if (is_null($num_errors)) { - throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['num_errors'] = $num_errors; + $this->container['errors'] = $errors; return $this; } /** - * Gets requested_at + * Gets links * - * @return \DateTime|null + * @return array|null */ - public function getRequestedAt() + public function getLinks() { - return $this->container['requested_at']; + return $this->container['links']; } /** - * Sets requested_at + * Sets links * - * @param \DateTime|null $requested_at Timestamp representing when the task was requested. + * @param array|null $links Link to check the status of the task. * * @return self */ - public function setRequestedAt($requested_at) + public function setLinks($links) { - if (is_null($requested_at)) { - throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['requested_at'] = $requested_at; + $this->container['links'] = $links; return $this; } /** - * Gets started_at + * Gets num_errors * - * @return \DateTime + * @return int|null */ - public function getStartedAt() + public function getNumErrors() { - return $this->container['started_at']; + return $this->container['num_errors']; } /** - * Sets started_at + * Sets num_errors * - * @param \DateTime $started_at Timestamp representing when the task was started at. + * @param int|null $num_errors Number of errors resulting from the requested changes. * * @return self */ - public function setStartedAt($started_at) + public function setNumErrors($num_errors) { - if (is_null($started_at)) { - throw new \InvalidArgumentException('non-nullable started_at cannot be null'); + if (is_null($num_errors)) { + throw new \InvalidArgumentException('non-nullable num_errors cannot be null'); } - $this->container['started_at'] = $started_at; + $this->container['num_errors'] = $num_errors; return $this; } /** - * Gets links + * Gets requested_at * - * @return array|null + * @return \DateTime|null */ - public function getLinks() + public function getRequestedAt() { - return $this->container['links']; + return $this->container['requested_at']; } /** - * Sets links + * Sets requested_at * - * @param array|null $links Link to check the status of the task. + * @param \DateTime|null $requested_at Timestamp representing when the task was requested. * * @return self */ - public function setLinks($links) + public function setRequestedAt($requested_at) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($requested_at)) { + throw new \InvalidArgumentException('non-nullable requested_at cannot be null'); } - $this->container['links'] = $links; + $this->container['requested_at'] = $requested_at; return $this; } /** - * Gets errors + * Gets result * - * @return \HubSpot\Client\Files\Model\StandardError[]|null + * @return \HubSpot\Client\Files\Model\Folder|null */ - public function getErrors() + public function getResult() { - return $this->container['errors']; + return $this->container['result']; } /** - * Sets errors + * Sets result * - * @param \HubSpot\Client\Files\Model\StandardError[]|null $errors Detailed errors resulting from the task. + * @param \HubSpot\Client\Files\Model\Folder|null $result result * * @return self */ - public function setErrors($errors) + public function setResult($result) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); } - $this->container['errors'] = $errors; + $this->container['result'] = $result; return $this; } /** - * Gets task_id + * Gets started_at * - * @return string + * @return \DateTime */ - public function getTaskId() + public function getStartedAt() { - return $this->container['task_id']; + return $this->container['started_at']; } /** - * Sets task_id + * Sets started_at * - * @param string $task_id ID of the task. + * @param \DateTime $started_at Timestamp representing when the task was started at. * * @return self */ - public function setTaskId($task_id) + public function setStartedAt($started_at) { - if (is_null($task_id)) { - throw new \InvalidArgumentException('non-nullable task_id cannot be null'); + if (is_null($started_at)) { + throw new \InvalidArgumentException('non-nullable started_at cannot be null'); } - $this->container['task_id'] = $task_id; + $this->container['started_at'] = $started_at; return $this; } @@ -637,14 +610,41 @@ public function setStatus($status) return $this; } + + /** + * Gets task_id + * + * @return string + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param string $task_id ID of the task. + * + * @return self + */ + public function setTaskId($task_id) + { + if (is_null($task_id)) { + throw new \InvalidArgumentException('non-nullable task_id cannot be null'); + } + $this->container['task_id'] = $task_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -652,12 +652,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -682,11 +682,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FolderInput.php b/codegen/Files/Model/FolderInput.php index cf79ce1c..4889bd97 100644 --- a/codegen/Files/Model/FolderInput.php +++ b/codegen/Files/Model/FolderInput.php @@ -2,7 +2,7 @@ /** * FolderInput * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,9 +58,9 @@ class FolderInput implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'name' => 'string', 'parent_folder_id' => 'string', - 'parent_path' => 'string', - 'name' => 'string' + 'parent_path' => 'string' ]; /** @@ -71,9 +71,9 @@ class FolderInput implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'name' => null, 'parent_folder_id' => null, - 'parent_path' => null, - 'name' => null + 'parent_path' => null ]; /** @@ -82,9 +82,9 @@ class FolderInput implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'name' => false, 'parent_folder_id' => false, - 'parent_path' => false, - 'name' => false + 'parent_path' => false ]; /** @@ -173,9 +173,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'name' => 'name', 'parent_folder_id' => 'parentFolderId', - 'parent_path' => 'parentPath', - 'name' => 'name' + 'parent_path' => 'parentPath' ]; /** @@ -184,9 +184,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'name' => 'setName', 'parent_folder_id' => 'setParentFolderId', - 'parent_path' => 'setParentPath', - 'name' => 'setName' + 'parent_path' => 'setParentPath' ]; /** @@ -195,9 +195,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'name' => 'getName', 'parent_folder_id' => 'getParentFolderId', - 'parent_path' => 'getParentPath', - 'name' => 'getName' + 'parent_path' => 'getParentPath' ]; /** @@ -257,9 +257,9 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('name', $data ?? [], null); $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('parent_path', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); } /** @@ -307,6 +307,33 @@ public function valid() } + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** * Gets parent_folder_id * @@ -320,7 +347,7 @@ public function getParentFolderId() /** * Sets parent_folder_id * - * @param string|null $parent_folder_id FolderId of the parent of the created folder. If not specified, the folder will be created at the root level. parentFolderId and parentFolderPath cannot be set at the same time. + * @param string|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ @@ -360,41 +387,14 @@ public function setParentPath($parent_path) return $this; } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Desired name for the folder. - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -402,12 +402,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -432,11 +432,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FolderUpdateInput.php b/codegen/Files/Model/FolderUpdateInput.php index c9769eaf..eeaa2498 100644 --- a/codegen/Files/Model/FolderUpdateInput.php +++ b/codegen/Files/Model/FolderUpdateInput.php @@ -2,7 +2,7 @@ /** * FolderUpdateInput * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,8 +58,8 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl * @var string[] */ protected static $openAPITypes = [ - 'parent_folder_id' => 'int', - 'name' => 'string' + 'name' => 'string', + 'parent_folder_id' => 'int' ]; /** @@ -70,8 +70,8 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl * @psalm-var array */ protected static $openAPIFormats = [ - 'parent_folder_id' => 'int64', - 'name' => null + 'name' => null, + 'parent_folder_id' => 'int64' ]; /** @@ -80,8 +80,8 @@ class FolderUpdateInput implements ModelInterface, ArrayAccess, \JsonSerializabl * @var boolean[] */ protected static array $openAPINullables = [ - 'parent_folder_id' => false, - 'name' => false + 'name' => false, + 'parent_folder_id' => false ]; /** @@ -170,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'parent_folder_id' => 'parentFolderId', - 'name' => 'name' + 'name' => 'name', + 'parent_folder_id' => 'parentFolderId' ]; /** @@ -180,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'parent_folder_id' => 'setParentFolderId', - 'name' => 'setName' + 'name' => 'setName', + 'parent_folder_id' => 'setParentFolderId' ]; /** @@ -190,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'parent_folder_id' => 'getParentFolderId', - 'name' => 'getName' + 'name' => 'getName', + 'parent_folder_id' => 'getParentFolderId' ]; /** @@ -251,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('parent_folder_id', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_folder_id', $data ?? [], null); } /** @@ -298,66 +298,66 @@ public function valid() /** - * Gets parent_folder_id + * Gets name * - * @return int|null + * @return string|null */ - public function getParentFolderId() + public function getName() { - return $this->container['parent_folder_id']; + return $this->container['name']; } /** - * Sets parent_folder_id + * Sets name * - * @param int|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ - public function setParentFolderId($parent_folder_id) + public function setName($name) { - if (is_null($parent_folder_id)) { - throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['parent_folder_id'] = $parent_folder_id; + $this->container['name'] = $name; return $this; } /** - * Gets name + * Gets parent_folder_id * - * @return string|null + * @return int|null */ - public function getName() + public function getParentFolderId() { - return $this->container['name']; + return $this->container['parent_folder_id']; } /** - * Sets name + * Sets parent_folder_id * - * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. + * @param int|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ - public function setName($name) + public function setParentFolderId($parent_folder_id) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); } - $this->container['name'] = $name; + $this->container['parent_folder_id'] = $parent_folder_id; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -365,12 +365,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -395,11 +395,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FolderUpdateInputWithId.php b/codegen/Files/Model/FolderUpdateInputWithId.php index 7898fec1..47344615 100644 --- a/codegen/Files/Model/FolderUpdateInputWithId.php +++ b/codegen/Files/Model/FolderUpdateInputWithId.php @@ -2,7 +2,7 @@ /** * FolderUpdateInputWithId * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,9 +57,9 @@ class FolderUpdateInputWithId implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'parent_folder_id' => 'int', + 'id' => 'string', 'name' => 'string', - 'id' => 'string' + 'parent_folder_id' => 'int' ]; /** @@ -70,9 +70,9 @@ class FolderUpdateInputWithId implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'parent_folder_id' => 'int64', + 'id' => null, 'name' => null, - 'id' => null + 'parent_folder_id' => 'int64' ]; /** @@ -81,9 +81,9 @@ class FolderUpdateInputWithId implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'parent_folder_id' => false, + 'id' => false, 'name' => false, - 'id' => false + 'parent_folder_id' => false ]; /** @@ -172,9 +172,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'parent_folder_id' => 'parentFolderId', + 'id' => 'id', 'name' => 'name', - 'id' => 'id' + 'parent_folder_id' => 'parentFolderId' ]; /** @@ -183,9 +183,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'parent_folder_id' => 'setParentFolderId', + 'id' => 'setId', 'name' => 'setName', - 'id' => 'setId' + 'parent_folder_id' => 'setParentFolderId' ]; /** @@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'parent_folder_id' => 'getParentFolderId', + 'id' => 'getId', 'name' => 'getName', - 'id' => 'getId' + 'parent_folder_id' => 'getParentFolderId' ]; /** @@ -256,9 +256,9 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('parent_folder_id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('parent_folder_id', $data ?? [], null); } /** @@ -307,28 +307,28 @@ public function valid() /** - * Gets parent_folder_id + * Gets id * - * @return int|null + * @return string */ - public function getParentFolderId() + public function getId() { - return $this->container['parent_folder_id']; + return $this->container['id']; } /** - * Sets parent_folder_id + * Sets id * - * @param int|null $parent_folder_id parent_folder_id + * @param string $id The unique identifier of the folder to be updated. * * @return self */ - public function setParentFolderId($parent_folder_id) + public function setId($id) { - if (is_null($parent_folder_id)) { - throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['parent_folder_id'] = $parent_folder_id; + $this->container['id'] = $id; return $this; } @@ -346,7 +346,7 @@ public function getName() /** * Sets name * - * @param string|null $name name + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ @@ -361,39 +361,39 @@ public function setName($name) } /** - * Gets id + * Gets parent_folder_id * - * @return string + * @return int|null */ - public function getId() + public function getParentFolderId() { - return $this->container['id']; + return $this->container['parent_folder_id']; } /** - * Sets id + * Sets parent_folder_id * - * @param string $id id + * @param int|null $parent_folder_id New parent folderId. If changed, the folder and all it's children will be moved into the specified folder. parentFolderId and parentFolderPath cannot be specified at the same time. * * @return self */ - public function setId($id) + public function setParentFolderId($parent_folder_id) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($parent_folder_id)) { + throw new \InvalidArgumentException('non-nullable parent_folder_id cannot be null'); } - $this->container['id'] = $id; + $this->container['parent_folder_id'] = $parent_folder_id; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -401,12 +401,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -431,11 +431,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/FolderUpdateTaskLocator.php b/codegen/Files/Model/FolderUpdateTaskLocator.php index 33310cee..dead5b0d 100644 --- a/codegen/Files/Model/FolderUpdateTaskLocator.php +++ b/codegen/Files/Model/FolderUpdateTaskLocator.php @@ -2,7 +2,7 @@ /** * FolderUpdateTaskLocator * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,8 +58,8 @@ class FolderUpdateTaskLocator implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'links' => 'array', - 'id' => 'string' + 'id' => 'string', + 'links' => 'array' ]; /** @@ -70,8 +70,8 @@ class FolderUpdateTaskLocator implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ - 'links' => null, - 'id' => null + 'id' => null, + 'links' => null ]; /** @@ -80,8 +80,8 @@ class FolderUpdateTaskLocator implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ - 'links' => false, - 'id' => false + 'id' => false, + 'links' => false ]; /** @@ -170,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'links' => 'links', - 'id' => 'id' + 'id' => 'id', + 'links' => 'links' ]; /** @@ -180,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'links' => 'setLinks', - 'id' => 'setId' + 'id' => 'setId', + 'links' => 'setLinks' ]; /** @@ -190,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'links' => 'getLinks', - 'id' => 'getId' + 'id' => 'getId', + 'links' => 'getLinks' ]; /** @@ -251,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); } /** @@ -282,12 +282,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['links'] === null) { - $invalidProperties[] = "'links' can't be null"; - } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } return $invalidProperties; } @@ -304,66 +304,66 @@ public function valid() /** - * Gets links + * Gets id * - * @return array + * @return string */ - public function getLinks() + public function getId() { - return $this->container['links']; + return $this->container['id']; } /** - * Sets links + * Sets id * - * @param array $links Links for where to check information related to the task. The `status` link gives the URL for where to check the status of the task. + * @param string $id ID of the task * * @return self */ - public function setLinks($links) + public function setId($id) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['links'] = $links; + $this->container['id'] = $id; return $this; } /** - * Gets id + * Gets links * - * @return string + * @return array */ - public function getId() + public function getLinks() { - return $this->container['id']; + return $this->container['links']; } /** - * Sets id + * Sets links * - * @param string $id ID of the task + * @param array $links Links for where to check information related to the task. The `status` link gives the URL for where to check the status of the task. * * @return self */ - public function setId($id) + public function setLinks($links) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['id'] = $id; + $this->container['links'] = $links; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -371,12 +371,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -401,11 +401,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/ImportFromUrlInput.php b/codegen/Files/Model/ImportFromUrlInput.php index 942eaaf5..9e169409 100644 --- a/codegen/Files/Model/ImportFromUrlInput.php +++ b/codegen/Files/Model/ImportFromUrlInput.php @@ -2,7 +2,7 @@ /** * ImportFromUrlInput * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -57,16 +57,16 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab * @var string[] */ protected static $openAPITypes = [ - 'folder_path' => 'string', 'access' => 'string', 'duplicate_validation_scope' => 'string', - 'name' => 'string', 'duplicate_validation_strategy' => 'string', - 'ttl' => 'string', - 'overwrite' => 'bool', 'expires_at' => '\DateTime', - 'url' => 'string', - 'folder_id' => 'string' + 'folder_id' => 'string', + 'folder_path' => 'string', + 'name' => 'string', + 'overwrite' => 'bool', + 'ttl' => 'string', + 'url' => 'string' ]; /** @@ -77,16 +77,16 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab * @psalm-var array */ protected static $openAPIFormats = [ - 'folder_path' => null, 'access' => null, 'duplicate_validation_scope' => null, - 'name' => null, 'duplicate_validation_strategy' => null, - 'ttl' => null, - 'overwrite' => null, 'expires_at' => 'date-time', - 'url' => null, - 'folder_id' => null + 'folder_id' => null, + 'folder_path' => null, + 'name' => null, + 'overwrite' => null, + 'ttl' => null, + 'url' => null ]; /** @@ -95,16 +95,16 @@ class ImportFromUrlInput implements ModelInterface, ArrayAccess, \JsonSerializab * @var boolean[] */ protected static array $openAPINullables = [ - 'folder_path' => false, 'access' => false, 'duplicate_validation_scope' => false, - 'name' => false, 'duplicate_validation_strategy' => false, - 'ttl' => false, - 'overwrite' => false, 'expires_at' => false, - 'url' => false, - 'folder_id' => false + 'folder_id' => false, + 'folder_path' => false, + 'name' => false, + 'overwrite' => false, + 'ttl' => false, + 'url' => false ]; /** @@ -193,16 +193,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'folder_path' => 'folderPath', 'access' => 'access', 'duplicate_validation_scope' => 'duplicateValidationScope', - 'name' => 'name', 'duplicate_validation_strategy' => 'duplicateValidationStrategy', - 'ttl' => 'ttl', - 'overwrite' => 'overwrite', 'expires_at' => 'expiresAt', - 'url' => 'url', - 'folder_id' => 'folderId' + 'folder_id' => 'folderId', + 'folder_path' => 'folderPath', + 'name' => 'name', + 'overwrite' => 'overwrite', + 'ttl' => 'ttl', + 'url' => 'url' ]; /** @@ -211,16 +211,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'folder_path' => 'setFolderPath', 'access' => 'setAccess', 'duplicate_validation_scope' => 'setDuplicateValidationScope', - 'name' => 'setName', 'duplicate_validation_strategy' => 'setDuplicateValidationStrategy', - 'ttl' => 'setTtl', - 'overwrite' => 'setOverwrite', 'expires_at' => 'setExpiresAt', - 'url' => 'setUrl', - 'folder_id' => 'setFolderId' + 'folder_id' => 'setFolderId', + 'folder_path' => 'setFolderPath', + 'name' => 'setName', + 'overwrite' => 'setOverwrite', + 'ttl' => 'setTtl', + 'url' => 'setUrl' ]; /** @@ -229,16 +229,16 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'folder_path' => 'getFolderPath', 'access' => 'getAccess', 'duplicate_validation_scope' => 'getDuplicateValidationScope', - 'name' => 'getName', 'duplicate_validation_strategy' => 'getDuplicateValidationStrategy', - 'ttl' => 'getTtl', - 'overwrite' => 'getOverwrite', 'expires_at' => 'getExpiresAt', - 'url' => 'getUrl', - 'folder_id' => 'getFolderId' + 'folder_id' => 'getFolderId', + 'folder_path' => 'getFolderPath', + 'name' => 'getName', + 'overwrite' => 'getOverwrite', + 'ttl' => 'getTtl', + 'url' => 'getUrl' ]; /** @@ -282,13 +282,13 @@ public function getModelName() return self::$openAPIModelName; } - public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; - public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_HIDDEN_INDEXABLE = 'HIDDEN_INDEXABLE'; public const ACCESS_HIDDEN_NOT_INDEXABLE = 'HIDDEN_NOT_INDEXABLE'; public const ACCESS_HIDDEN_PRIVATE = 'HIDDEN_PRIVATE'; - public const ACCESS__PRIVATE = 'PRIVATE'; public const ACCESS_HIDDEN_SENSITIVE = 'HIDDEN_SENSITIVE'; + public const ACCESS__PRIVATE = 'PRIVATE'; + public const ACCESS_PUBLIC_INDEXABLE = 'PUBLIC_INDEXABLE'; + public const ACCESS_PUBLIC_NOT_INDEXABLE = 'PUBLIC_NOT_INDEXABLE'; public const ACCESS_SENSITIVE = 'SENSITIVE'; public const DUPLICATE_VALIDATION_SCOPE_ENTIRE_PORTAL = 'ENTIRE_PORTAL'; public const DUPLICATE_VALIDATION_SCOPE_EXACT_FOLDER = 'EXACT_FOLDER'; @@ -304,13 +304,13 @@ public function getModelName() public function getAccessAllowableValues() { return [ - self::ACCESS_PUBLIC_INDEXABLE, - self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_HIDDEN_INDEXABLE, self::ACCESS_HIDDEN_NOT_INDEXABLE, self::ACCESS_HIDDEN_PRIVATE, - self::ACCESS__PRIVATE, self::ACCESS_HIDDEN_SENSITIVE, + self::ACCESS__PRIVATE, + self::ACCESS_PUBLIC_INDEXABLE, + self::ACCESS_PUBLIC_NOT_INDEXABLE, self::ACCESS_SENSITIVE, ]; } @@ -357,16 +357,16 @@ public function getDuplicateValidationStrategyAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('folder_path', $data ?? [], null); $this->setIfExists('access', $data ?? [], null); $this->setIfExists('duplicate_validation_scope', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); $this->setIfExists('duplicate_validation_strategy', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('overwrite', $data ?? [], null); $this->setIfExists('expires_at', $data ?? [], null); - $this->setIfExists('url', $data ?? [], null); $this->setIfExists('folder_id', $data ?? [], null); + $this->setIfExists('folder_path', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('overwrite', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); } /** @@ -444,33 +444,6 @@ public function valid() } - /** - * Gets folder_path - * - * @return string|null - */ - public function getFolderPath() - { - return $this->container['folder_path']; - } - - /** - * Sets folder_path - * - * @param string|null $folder_path One of folderPath or folderId is required. Destination folder path for the uploaded file. If the folder path does not exist, there will be an attempt to create the folder path. - * - * @return self - */ - public function setFolderPath($folder_path) - { - if (is_null($folder_path)) { - throw new \InvalidArgumentException('non-nullable folder_path cannot be null'); - } - $this->container['folder_path'] = $folder_path; - - return $this; - } - /** * Gets access * @@ -545,33 +518,6 @@ public function setDuplicateValidationScope($duplicate_validation_scope) return $this; } - /** - * Gets name - * - * @return string|null - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string|null $name Name to give the resulting file in the file manager. - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - /** * Gets duplicate_validation_strategy * @@ -610,28 +556,109 @@ public function setDuplicateValidationStrategy($duplicate_validation_strategy) } /** - * Gets ttl + * Gets expires_at + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime|null $expires_at Specifies the date and time when the file will expire. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + + /** + * Gets folder_id * * @return string|null */ - public function getTtl() + public function getFolderId() { - return $this->container['ttl']; + return $this->container['folder_id']; } /** - * Sets ttl + * Sets folder_id * - * @param string|null $ttl Time to live. If specified the file will be deleted after the given time frame. If left unset, the file will exist indefinitely + * @param string|null $folder_id One of folderId or folderPath is required. Destination folderId for the uploaded file. * * @return self */ - public function setTtl($ttl) + public function setFolderId($folder_id) { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + if (is_null($folder_id)) { + throw new \InvalidArgumentException('non-nullable folder_id cannot be null'); } - $this->container['ttl'] = $ttl; + $this->container['folder_id'] = $folder_id; + + return $this; + } + + /** + * Gets folder_path + * + * @return string|null + */ + public function getFolderPath() + { + return $this->container['folder_path']; + } + + /** + * Sets folder_path + * + * @param string|null $folder_path One of folderPath or folderId is required. Destination folder path for the uploaded file. If the folder path does not exist, there will be an attempt to create the folder path. + * + * @return self + */ + public function setFolderPath($folder_path) + { + if (is_null($folder_path)) { + throw new \InvalidArgumentException('non-nullable folder_path cannot be null'); + } + $this->container['folder_path'] = $folder_path; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; return $this; } @@ -664,28 +691,28 @@ public function setOverwrite($overwrite) } /** - * Gets expires_at + * Gets ttl * - * @return \DateTime|null + * @return string|null */ - public function getExpiresAt() + public function getTtl() { - return $this->container['expires_at']; + return $this->container['ttl']; } /** - * Sets expires_at + * Sets ttl * - * @param \DateTime|null $expires_at expires_at + * @param string|null $ttl Time to live. If specified the file will be deleted after the given time frame. If left unset, the file will exist indefinitely * * @return self */ - public function setExpiresAt($expires_at) + public function setTtl($ttl) { - if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); } - $this->container['expires_at'] = $expires_at; + $this->container['ttl'] = $ttl; return $this; } @@ -716,41 +743,14 @@ public function setUrl($url) return $this; } - - /** - * Gets folder_id - * - * @return string|null - */ - public function getFolderId() - { - return $this->container['folder_id']; - } - - /** - * Sets folder_id - * - * @param string|null $folder_id One of folderId or folderPath is required. Destination folderId for the uploaded file. - * - * @return self - */ - public function setFolderId($folder_id) - { - if (is_null($folder_id)) { - throw new \InvalidArgumentException('non-nullable folder_id cannot be null'); - } - $this->container['folder_id'] = $folder_id; - - return $this; - } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -758,12 +758,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -788,11 +788,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/ImportFromUrlTaskLocator.php b/codegen/Files/Model/ImportFromUrlTaskLocator.php index 65bd2acc..1c0bde89 100644 --- a/codegen/Files/Model/ImportFromUrlTaskLocator.php +++ b/codegen/Files/Model/ImportFromUrlTaskLocator.php @@ -2,7 +2,7 @@ /** * ImportFromUrlTaskLocator * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,8 +58,8 @@ class ImportFromUrlTaskLocator implements ModelInterface, ArrayAccess, \JsonSeri * @var string[] */ protected static $openAPITypes = [ - 'links' => 'array', - 'id' => 'string' + 'id' => 'string', + 'links' => 'array' ]; /** @@ -70,8 +70,8 @@ class ImportFromUrlTaskLocator implements ModelInterface, ArrayAccess, \JsonSeri * @psalm-var array */ protected static $openAPIFormats = [ - 'links' => null, - 'id' => null + 'id' => null, + 'links' => null ]; /** @@ -80,8 +80,8 @@ class ImportFromUrlTaskLocator implements ModelInterface, ArrayAccess, \JsonSeri * @var boolean[] */ protected static array $openAPINullables = [ - 'links' => false, - 'id' => false + 'id' => false, + 'links' => false ]; /** @@ -170,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'links' => 'links', - 'id' => 'id' + 'id' => 'id', + 'links' => 'links' ]; /** @@ -180,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'links' => 'setLinks', - 'id' => 'setId' + 'id' => 'setId', + 'links' => 'setLinks' ]; /** @@ -190,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'links' => 'getLinks', - 'id' => 'getId' + 'id' => 'getId', + 'links' => 'getLinks' ]; /** @@ -251,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('links', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); } /** @@ -282,12 +282,12 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['links'] === null) { - $invalidProperties[] = "'links' can't be null"; - } if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } return $invalidProperties; } @@ -304,66 +304,66 @@ public function valid() /** - * Gets links + * Gets id * - * @return array + * @return string */ - public function getLinks() + public function getId() { - return $this->container['links']; + return $this->container['id']; } /** - * Sets links + * Sets id * - * @param array $links Links for where to check information related to the task. The `status` link gives the URL for where to check the status of the task. + * @param string $id ID of the task * * @return self */ - public function setLinks($links) + public function setId($id) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); } - $this->container['links'] = $links; + $this->container['id'] = $id; return $this; } /** - * Gets id + * Gets links * - * @return string + * @return array */ - public function getId() + public function getLinks() { - return $this->container['id']; + return $this->container['links']; } /** - * Sets id + * Sets links * - * @param string $id ID of the task + * @param array $links Links for where to check information related to the task. The `status` link gives the URL for where to check the status of the task. * * @return self */ - public function setId($id) + public function setLinks($links) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['id'] = $id; + $this->container['links'] = $links; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -371,12 +371,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -401,11 +401,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/ModelInterface.php b/codegen/Files/Model/ModelInterface.php index 7d321f06..503e2087 100644 --- a/codegen/Files/Model/ModelInterface.php +++ b/codegen/Files/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files\Model @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** diff --git a/codegen/Files/Model/NextPage.php b/codegen/Files/Model/NextPage.php index f5d250df..c772de69 100644 --- a/codegen/Files/Model/NextPage.php +++ b/codegen/Files/Model/NextPage.php @@ -2,7 +2,7 @@ /** * NextPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * NextPage Class Doc Comment * * @category Class + * @description Specifies the paging information needed to retrieve the next set of results in a paginated API response * @package HubSpot\Client\Files * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,8 +58,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'link' => 'string', - 'after' => 'string' + 'after' => 'string', + 'link' => 'string' ]; /** @@ -69,8 +70,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'link' => null, - 'after' => null + 'after' => null, + 'link' => null ]; /** @@ -79,8 +80,8 @@ class NextPage implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'link' => false, - 'after' => false + 'after' => false, + 'link' => false ]; /** @@ -169,8 +170,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'link' => 'link', - 'after' => 'after' + 'after' => 'after', + 'link' => 'link' ]; /** @@ -179,8 +180,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'link' => 'setLink', - 'after' => 'setAfter' + 'after' => 'setAfter', + 'link' => 'setLink' ]; /** @@ -189,8 +190,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'link' => 'getLink', - 'after' => 'getAfter' + 'after' => 'getAfter', + 'link' => 'getLink' ]; /** @@ -250,8 +251,8 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('link', $data ?? [], null); $this->setIfExists('after', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); } /** @@ -300,66 +301,66 @@ public function valid() /** - * Gets link + * Gets after * - * @return string|null + * @return string */ - public function getLink() + public function getAfter() { - return $this->container['link']; + return $this->container['after']; } /** - * Sets link + * Sets after * - * @param string|null $link link + * @param string $after A paging cursor token for retrieving subsequent pages. * * @return self */ - public function setLink($link) + public function setAfter($after) { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); + if (is_null($after)) { + throw new \InvalidArgumentException('non-nullable after cannot be null'); } - $this->container['link'] = $link; + $this->container['after'] = $after; return $this; } /** - * Gets after + * Gets link * - * @return string + * @return string|null */ - public function getAfter() + public function getLink() { - return $this->container['after']; + return $this->container['link']; } /** - * Sets after + * Sets link * - * @param string $after after + * @param string|null $link A URL that can be used to retrieve the next page results. * * @return self */ - public function setAfter($after) + public function setLink($link) { - if (is_null($after)) { - throw new \InvalidArgumentException('non-nullable after cannot be null'); + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); } - $this->container['after'] = $after; + $this->container['link'] = $link; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -367,12 +368,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +398,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/Paging.php b/codegen/Files/Model/Paging.php index 1a0986d4..12fc75f0 100644 --- a/codegen/Files/Model/Paging.php +++ b/codegen/Files/Model/Paging.php @@ -2,7 +2,7 @@ /** * Paging * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -352,11 +352,11 @@ public function setPrev($prev) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -364,12 +364,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -394,11 +394,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/PreviousPage.php b/codegen/Files/Model/PreviousPage.php index 001b56b3..f47b69e9 100644 --- a/codegen/Files/Model/PreviousPage.php +++ b/codegen/Files/Model/PreviousPage.php @@ -2,7 +2,7 @@ /** * PreviousPage * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * PreviousPage Class Doc Comment * * @category Class + * @description specifies the paging information needed to retrieve the previous set of results in a paginated API response * @package HubSpot\Client\Files * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -312,7 +313,7 @@ public function getBefore() /** * Sets before * - * @param string $before before + * @param string $before A paging cursor token for retrieving previous pages. * * @return self */ @@ -339,7 +340,7 @@ public function getLink() /** * Sets link * - * @param string|null $link link + * @param string|null $link A URL that can be used to retrieve the previous pages' results. * * @return self */ @@ -355,11 +356,11 @@ public function setLink($link) /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -367,12 +368,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -397,11 +398,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/SignedUrl.php b/codegen/Files/Model/SignedUrl.php index 16e963ca..86596af5 100644 --- a/codegen/Files/Model/SignedUrl.php +++ b/codegen/Files/Model/SignedUrl.php @@ -2,7 +2,7 @@ /** * SignedUrl * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -58,14 +58,14 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'expires_at' => '\DateTime', 'extension' => 'string', - 'size' => 'int', + 'height' => 'int', 'name' => 'string', - 'width' => 'int', + 'size' => 'int', 'type' => 'string', 'url' => 'string', - 'expires_at' => '\DateTime', - 'height' => 'int' + 'width' => 'int' ]; /** @@ -76,14 +76,14 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'expires_at' => 'date-time', 'extension' => null, - 'size' => 'int64', + 'height' => 'int32', 'name' => null, - 'width' => 'int32', + 'size' => 'int64', 'type' => null, 'url' => null, - 'expires_at' => 'date-time', - 'height' => 'int32' + 'width' => 'int32' ]; /** @@ -92,14 +92,14 @@ class SignedUrl implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'expires_at' => false, 'extension' => false, - 'size' => false, + 'height' => false, 'name' => false, - 'width' => false, + 'size' => false, 'type' => false, 'url' => false, - 'expires_at' => false, - 'height' => false + 'width' => false ]; /** @@ -188,14 +188,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'expires_at' => 'expiresAt', 'extension' => 'extension', - 'size' => 'size', + 'height' => 'height', 'name' => 'name', - 'width' => 'width', + 'size' => 'size', 'type' => 'type', 'url' => 'url', - 'expires_at' => 'expiresAt', - 'height' => 'height' + 'width' => 'width' ]; /** @@ -204,14 +204,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'expires_at' => 'setExpiresAt', 'extension' => 'setExtension', - 'size' => 'setSize', + 'height' => 'setHeight', 'name' => 'setName', - 'width' => 'setWidth', + 'size' => 'setSize', 'type' => 'setType', 'url' => 'setUrl', - 'expires_at' => 'setExpiresAt', - 'height' => 'setHeight' + 'width' => 'setWidth' ]; /** @@ -220,14 +220,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'expires_at' => 'getExpiresAt', 'extension' => 'getExtension', - 'size' => 'getSize', + 'height' => 'getHeight', 'name' => 'getName', - 'width' => 'getWidth', + 'size' => 'getSize', 'type' => 'getType', 'url' => 'getUrl', - 'expires_at' => 'getExpiresAt', - 'height' => 'getHeight' + 'width' => 'getWidth' ]; /** @@ -287,14 +287,14 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('extension', $data ?? [], null); - $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); $this->setIfExists('url', $data ?? [], null); - $this->setIfExists('expires_at', $data ?? [], null); - $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); } /** @@ -324,24 +324,24 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['expires_at'] === null) { + $invalidProperties[] = "'expires_at' can't be null"; + } if ($this->container['extension'] === null) { $invalidProperties[] = "'extension' can't be null"; } - if ($this->container['size'] === null) { - $invalidProperties[] = "'size' can't be null"; - } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } if ($this->container['url'] === null) { $invalidProperties[] = "'url' can't be null"; } - if ($this->container['expires_at'] === null) { - $invalidProperties[] = "'expires_at' can't be null"; - } return $invalidProperties; } @@ -357,6 +357,33 @@ public function valid() } + /** + * Gets expires_at + * + * @return \DateTime + */ + public function getExpiresAt() + { + return $this->container['expires_at']; + } + + /** + * Sets expires_at + * + * @param \DateTime $expires_at Timestamp of when the URL will no longer grant access to the file. + * + * @return self + */ + public function setExpiresAt($expires_at) + { + if (is_null($expires_at)) { + throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + } + $this->container['expires_at'] = $expires_at; + + return $this; + } + /** * Gets extension * @@ -385,28 +412,28 @@ public function setExtension($extension) } /** - * Gets size + * Gets height * - * @return int + * @return int|null */ - public function getSize() + public function getHeight() { - return $this->container['size']; + return $this->container['height']; } /** - * Sets size + * Sets height * - * @param int $size Size in bytes of the requested file. + * @param int|null $height For image and video files. The height of the file. * * @return self */ - public function setSize($size) + public function setHeight($height) { - if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); + if (is_null($height)) { + throw new \InvalidArgumentException('non-nullable height cannot be null'); } - $this->container['size'] = $size; + $this->container['height'] = $height; return $this; } @@ -424,7 +451,7 @@ public function getName() /** * Sets name * - * @param string $name Name of the requested file. + * @param string $name New name. If specified the folder's name and fullPath will change. All children of the folder will be updated accordingly. * * @return self */ @@ -439,28 +466,28 @@ public function setName($name) } /** - * Gets width + * Gets size * - * @return int|null + * @return int */ - public function getWidth() + public function getSize() { - return $this->container['width']; + return $this->container['size']; } /** - * Sets width + * Sets size * - * @param int|null $width For image and video files. The width of the file. + * @param int $size Size in bytes of the requested file. * * @return self */ - public function setWidth($width) + public function setSize($size) { - if (is_null($width)) { - throw new \InvalidArgumentException('non-nullable width cannot be null'); + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); } - $this->container['width'] = $width; + $this->container['size'] = $size; return $this; } @@ -505,7 +532,7 @@ public function getUrl() /** * Sets url * - * @param string $url Signed URL with access to the specified file. Anyone with this URL will be able to access the file until it expires. + * @param string $url URL to download the new file from. * * @return self */ @@ -520,66 +547,39 @@ public function setUrl($url) } /** - * Gets expires_at - * - * @return \DateTime - */ - public function getExpiresAt() - { - return $this->container['expires_at']; - } - - /** - * Sets expires_at - * - * @param \DateTime $expires_at Timestamp of when the URL will no longer grant access to the file. - * - * @return self - */ - public function setExpiresAt($expires_at) - { - if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); - } - $this->container['expires_at'] = $expires_at; - - return $this; - } - - /** - * Gets height + * Gets width * * @return int|null */ - public function getHeight() + public function getWidth() { - return $this->container['height']; + return $this->container['width']; } /** - * Sets height + * Sets width * - * @param int|null $height For image and video files. The height of the file. + * @param int|null $width For image and video files. The width of the file. * * @return self */ - public function setHeight($height) + public function setWidth($width) { - if (is_null($height)) { - throw new \InvalidArgumentException('non-nullable height cannot be null'); + if (is_null($width)) { + throw new \InvalidArgumentException('non-nullable width cannot be null'); } - $this->container['height'] = $height; + $this->container['width'] = $width; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -587,12 +587,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -617,11 +617,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/Model/StandardError.php b/codegen/Files/Model/StandardError.php index 9e895eb7..f1d51430 100644 --- a/codegen/Files/Model/StandardError.php +++ b/codegen/Files/Model/StandardError.php @@ -2,7 +2,7 @@ /** * StandardError * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -35,6 +35,7 @@ * StandardError Class Doc Comment * * @category Class + * @description Ye olde error * @package HubSpot\Client\Files * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -57,14 +58,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'sub_category' => 'object', + 'category' => 'string', 'context' => 'array', - 'links' => 'array', + 'errors' => '\HubSpot\Client\Files\Model\ErrorDetail[]', 'id' => 'string', - 'category' => 'string', + 'links' => 'array', 'message' => 'string', - 'errors' => '\HubSpot\Client\Files\Model\ErrorDetail[]', - 'status' => 'string' + 'status' => 'string', + 'sub_category' => 'object' ]; /** @@ -75,14 +76,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'sub_category' => null, + 'category' => null, 'context' => null, - 'links' => null, + 'errors' => null, 'id' => null, - 'category' => null, + 'links' => null, 'message' => null, - 'errors' => null, - 'status' => null + 'status' => null, + 'sub_category' => null ]; /** @@ -91,14 +92,14 @@ class StandardError implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'sub_category' => false, + 'category' => false, 'context' => false, - 'links' => false, + 'errors' => false, 'id' => false, - 'category' => false, + 'links' => false, 'message' => false, - 'errors' => false, - 'status' => false + 'status' => false, + 'sub_category' => false ]; /** @@ -187,14 +188,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'sub_category' => 'subCategory', + 'category' => 'category', 'context' => 'context', - 'links' => 'links', + 'errors' => 'errors', 'id' => 'id', - 'category' => 'category', + 'links' => 'links', 'message' => 'message', - 'errors' => 'errors', - 'status' => 'status' + 'status' => 'status', + 'sub_category' => 'subCategory' ]; /** @@ -203,14 +204,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'sub_category' => 'setSubCategory', + 'category' => 'setCategory', 'context' => 'setContext', - 'links' => 'setLinks', + 'errors' => 'setErrors', 'id' => 'setId', - 'category' => 'setCategory', + 'links' => 'setLinks', 'message' => 'setMessage', - 'errors' => 'setErrors', - 'status' => 'setStatus' + 'status' => 'setStatus', + 'sub_category' => 'setSubCategory' ]; /** @@ -219,14 +220,14 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'sub_category' => 'getSubCategory', + 'category' => 'getCategory', 'context' => 'getContext', - 'links' => 'getLinks', + 'errors' => 'getErrors', 'id' => 'getId', - 'category' => 'getCategory', + 'links' => 'getLinks', 'message' => 'getMessage', - 'errors' => 'getErrors', - 'status' => 'getStatus' + 'status' => 'getStatus', + 'sub_category' => 'getSubCategory' ]; /** @@ -286,14 +287,14 @@ public function getModelName() */ public function __construct(?array $data = null) { - $this->setIfExists('sub_category', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); $this->setIfExists('context', $data ?? [], null); - $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('links', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); - $this->setIfExists('errors', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('sub_category', $data ?? [], null); } /** @@ -323,21 +324,21 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } if ($this->container['context'] === null) { $invalidProperties[] = "'context' can't be null"; } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } if ($this->container['links'] === null) { $invalidProperties[] = "'links' can't be null"; } - if ($this->container['category'] === null) { - $invalidProperties[] = "'category' can't be null"; - } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } if ($this->container['status'] === null) { $invalidProperties[] = "'status' can't be null"; } @@ -357,28 +358,28 @@ public function valid() /** - * Gets sub_category + * Gets category * - * @return object|null + * @return string */ - public function getSubCategory() + public function getCategory() { - return $this->container['sub_category']; + return $this->container['category']; } /** - * Sets sub_category + * Sets category * - * @param object|null $sub_category sub_category + * @param string $category The main category of the error. * * @return self */ - public function setSubCategory($sub_category) + public function setCategory($category) { - if (is_null($sub_category)) { - throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); } - $this->container['sub_category'] = $sub_category; + $this->container['category'] = $category; return $this; } @@ -396,7 +397,7 @@ public function getContext() /** * Sets context * - * @param array $context context + * @param array $context Additional context-specific information related to the error. * * @return self */ @@ -411,28 +412,28 @@ public function setContext($context) } /** - * Gets links + * Gets errors * - * @return array + * @return \HubSpot\Client\Files\Model\ErrorDetail[] */ - public function getLinks() + public function getErrors() { - return $this->container['links']; + return $this->container['errors']; } /** - * Sets links + * Sets errors * - * @param array $links links + * @param \HubSpot\Client\Files\Model\ErrorDetail[] $errors The detailed error objects. * * @return self */ - public function setLinks($links) + public function setErrors($errors) { - if (is_null($links)) { - throw new \InvalidArgumentException('non-nullable links cannot be null'); + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); } - $this->container['links'] = $links; + $this->container['errors'] = $errors; return $this; } @@ -450,7 +451,7 @@ public function getId() /** * Sets id * - * @param string|null $id id + * @param string|null $id A unique ID for the error instance. * * @return self */ @@ -465,28 +466,28 @@ public function setId($id) } /** - * Gets category + * Gets links * - * @return string + * @return array */ - public function getCategory() + public function getLinks() { - return $this->container['category']; + return $this->container['links']; } /** - * Sets category + * Sets links * - * @param string $category category + * @param array $links URLs linking to documentation or resources associated with the error. * * @return self */ - public function setCategory($category) + public function setLinks($links) { - if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); + if (is_null($links)) { + throw new \InvalidArgumentException('non-nullable links cannot be null'); } - $this->container['category'] = $category; + $this->container['links'] = $links; return $this; } @@ -504,7 +505,7 @@ public function getMessage() /** * Sets message * - * @param string $message message + * @param string $message A human-readable string describing the error and possible remediation steps. * * @return self */ @@ -519,66 +520,66 @@ public function setMessage($message) } /** - * Gets errors + * Gets status * - * @return \HubSpot\Client\Files\Model\ErrorDetail[] + * @return string */ - public function getErrors() + public function getStatus() { - return $this->container['errors']; + return $this->container['status']; } /** - * Sets errors + * Sets status * - * @param \HubSpot\Client\Files\Model\ErrorDetail[] $errors errors + * @param string $status The HTTP status code associated with the error. * * @return self */ - public function setErrors($errors) + public function setStatus($status) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $this->container['errors'] = $errors; + $this->container['status'] = $status; return $this; } /** - * Gets status + * Gets sub_category * - * @return string + * @return object|null */ - public function getStatus() + public function getSubCategory() { - return $this->container['status']; + return $this->container['sub_category']; } /** - * Sets status + * Sets sub_category * - * @param string $status status + * @param object|null $sub_category A more specific error category within each main category. * * @return self */ - public function setStatus($status) + public function setSubCategory($sub_category) { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); + if (is_null($sub_category)) { + throw new \InvalidArgumentException('non-nullable sub_category cannot be null'); } - $this->container['status'] = $status; + $this->container['sub_category'] = $sub_category; return $this; } /** * Returns true if offset exists. False otherwise. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -586,12 +587,12 @@ public function offsetExists($offset): bool /** * Gets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset) { return $this->container[$offset] ?? null; } @@ -616,11 +617,11 @@ public function offsetSet($offset, $value): void /** * Unsets offset. * - * @param integer $offset Offset + * @param integer|string $offset Offset * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } diff --git a/codegen/Files/ObjectSerializer.php b/codegen/Files/ObjectSerializer.php index 53d05ad3..45e250ed 100644 --- a/codegen/Files/ObjectSerializer.php +++ b/codegen/Files/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 8.1 * * @category Class * @package HubSpot\Client\Files @@ -11,13 +11,13 @@ */ /** - * Files + * Files Files * * Upload and manage files. * * The version of the OpenAPI document: v3 * Generated by: https://openapi-generator.tech - * Generator version: 7.12.0 + * Generator version: 7.19.0 */ /** @@ -323,24 +323,6 @@ public static function toHeaderValue($value) return self::toString($value); } - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged @@ -612,6 +594,6 @@ public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): } } - return $qs ? (string) substr($qs, 0, -1) : ''; + return $qs ? substr($qs, 0, -1) : ''; } }