From a6efa59e32d58c56527dcaabeab99f0e645ff342 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Fri, 19 Dec 2025 15:56:50 -0500 Subject: [PATCH 1/4] Add import/export API and models for OpenAPI Introduces new API classes for database export, export part, import, and import chunk operations, along with their corresponding model classes. Also updates the OpenAPI generator workflow to use the correct composer script name. --- .github/workflows/openapi-generator.yml | 2 +- api/src/API/DatabaseExportApi.php | 510 ++++++ api/src/API/DatabaseExportPartApi.php | 559 +++++++ api/src/API/ImportApi.php | 1486 +++++++++++++++++ api/src/API/ImportChunkApi.php | 532 ++++++ api/src/Model/CreateImport201Response.php | 451 +++++ .../Model/CreateImportChunk201Response.php | 451 +++++ api/src/Model/DeleteImport200Response.php | 414 +++++ api/src/Model/GetImport200Response.php | 451 +++++ .../ImportChunkControllerStoreRequest.php | 448 +++++ .../ImportChunkControllerStoreResponse.php | 442 +++++ .../Model/ImportControllerShowResponse.php | 748 +++++++++ .../Model/ImportControllerStoreRequest.php | 448 +++++ .../Model/ImportControllerStoreResponse.php | 578 +++++++ api/src/Model/Privilege.php | 6 + api/src/Model/UpdateImport200Response.php | 414 +++++ 16 files changed, 7939 insertions(+), 1 deletion(-) create mode 100644 api/src/API/DatabaseExportApi.php create mode 100644 api/src/API/DatabaseExportPartApi.php create mode 100644 api/src/API/ImportApi.php create mode 100644 api/src/API/ImportChunkApi.php create mode 100644 api/src/Model/CreateImport201Response.php create mode 100644 api/src/Model/CreateImportChunk201Response.php create mode 100644 api/src/Model/DeleteImport200Response.php create mode 100644 api/src/Model/GetImport200Response.php create mode 100644 api/src/Model/ImportChunkControllerStoreRequest.php create mode 100644 api/src/Model/ImportChunkControllerStoreResponse.php create mode 100644 api/src/Model/ImportControllerShowResponse.php create mode 100644 api/src/Model/ImportControllerStoreRequest.php create mode 100644 api/src/Model/ImportControllerStoreResponse.php create mode 100644 api/src/Model/UpdateImport200Response.php diff --git a/.github/workflows/openapi-generator.yml b/.github/workflows/openapi-generator.yml index 91f6e1f..3a7f69f 100644 --- a/.github/workflows/openapi-generator.yml +++ b/.github/workflows/openapi-generator.yml @@ -63,7 +63,7 @@ jobs: --title "Update OpenAPI generated files" \ --body "This PR contains updates to the OpenAPI generated files. - Generated by running \`composer run generate_openapi\`." \ + Generated by running \`composer run generate_open_api\`." \ --base main \ --head ${{ steps.commit.outputs.branch_name }} \ --label automated,openapi diff --git a/api/src/API/DatabaseExportApi.php b/api/src/API/DatabaseExportApi.php new file mode 100644 index 0000000..40a955e --- /dev/null +++ b/api/src/API/DatabaseExportApi.php @@ -0,0 +1,510 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createDatabaseExport + * + * Create a new database export + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param object $body Database export creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function createDatabaseExport($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) + { + list($response) = $this->createDatabaseExportWithHttpInfo($databaseName, $branchName, $body, $contentType); + return $response; + } + + /** + * Operation createDatabaseExportWithHttpInfo + * + * Create a new database export + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param object $body Database export creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createDatabaseExportWithHttpInfo($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) + { + $request = $this->createDatabaseExportRequest($databaseName, $branchName, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createDatabaseExportAsync + * + * Create a new database export + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param object $body Database export creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDatabaseExportAsync($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) + { + return $this->createDatabaseExportAsyncWithHttpInfo($databaseName, $branchName, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDatabaseExportAsyncWithHttpInfo + * + * Create a new database export + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param object $body Database export creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDatabaseExportAsyncWithHttpInfo($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) + { + $returnType = 'object'; + $request = $this->createDatabaseExportRequest($databaseName, $branchName, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createDatabaseExport' + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param object $body Database export creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDatabaseExportRequest($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) + { + + // verify the required parameter 'databaseName' is set + if ($databaseName === null || (is_array($databaseName) && count($databaseName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $databaseName when calling createDatabaseExport' + ); + } + + // verify the required parameter 'branchName' is set + if ($branchName === null || (is_array($branchName) && count($branchName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $branchName when calling createDatabaseExport' + ); + } + + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createDatabaseExport' + ); + } + + + $resourcePath = '/v1/databases/{databaseName}/branches/{branchName}/export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($databaseName !== null) { + $resourcePath = str_replace( + '{' . 'databaseName' . '}', + ObjectSerializer::toPathValue($databaseName), + $resourcePath + ); + } + // path params + if ($branchName !== null) { + $resourcePath = str_replace( + '{' . 'branchName' . '}', + ObjectSerializer::toPathValue($branchName), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + 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/api/src/API/DatabaseExportPartApi.php b/api/src/API/DatabaseExportPartApi.php new file mode 100644 index 0000000..12a7532 --- /dev/null +++ b/api/src/API/DatabaseExportPartApi.php @@ -0,0 +1,559 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation getDatabaseExportPart + * + * Show details of a specific database export part + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param string $rangeNumber The rangeNumber parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDatabaseExportPart'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function getDatabaseExportPart($databaseName, $branchName, $exportId, $rangeNumber, string $contentType = self::contentTypes['getDatabaseExportPart'][0]) + { + list($response) = $this->getDatabaseExportPartWithHttpInfo($databaseName, $branchName, $exportId, $rangeNumber, $contentType); + return $response; + } + + /** + * Operation getDatabaseExportPartWithHttpInfo + * + * Show details of a specific database export part + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param string $rangeNumber The rangeNumber parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDatabaseExportPart'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getDatabaseExportPartWithHttpInfo($databaseName, $branchName, $exportId, $rangeNumber, string $contentType = self::contentTypes['getDatabaseExportPart'][0]) + { + $request = $this->getDatabaseExportPartRequest($databaseName, $branchName, $exportId, $rangeNumber, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getDatabaseExportPartAsync + * + * Show details of a specific database export part + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param string $rangeNumber The rangeNumber parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDatabaseExportPart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDatabaseExportPartAsync($databaseName, $branchName, $exportId, $rangeNumber, string $contentType = self::contentTypes['getDatabaseExportPart'][0]) + { + return $this->getDatabaseExportPartAsyncWithHttpInfo($databaseName, $branchName, $exportId, $rangeNumber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDatabaseExportPartAsyncWithHttpInfo + * + * Show details of a specific database export part + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param string $rangeNumber The rangeNumber parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDatabaseExportPart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDatabaseExportPartAsyncWithHttpInfo($databaseName, $branchName, $exportId, $rangeNumber, string $contentType = self::contentTypes['getDatabaseExportPart'][0]) + { + $returnType = 'object'; + $request = $this->getDatabaseExportPartRequest($databaseName, $branchName, $exportId, $rangeNumber, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getDatabaseExportPart' + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param string $rangeNumber The rangeNumber parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDatabaseExportPart'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDatabaseExportPartRequest($databaseName, $branchName, $exportId, $rangeNumber, string $contentType = self::contentTypes['getDatabaseExportPart'][0]) + { + + // verify the required parameter 'databaseName' is set + if ($databaseName === null || (is_array($databaseName) && count($databaseName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $databaseName when calling getDatabaseExportPart' + ); + } + + // verify the required parameter 'branchName' is set + if ($branchName === null || (is_array($branchName) && count($branchName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $branchName when calling getDatabaseExportPart' + ); + } + + // verify the required parameter 'exportId' is set + if ($exportId === null || (is_array($exportId) && count($exportId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exportId when calling getDatabaseExportPart' + ); + } + + // verify the required parameter 'rangeNumber' is set + if ($rangeNumber === null || (is_array($rangeNumber) && count($rangeNumber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rangeNumber when calling getDatabaseExportPart' + ); + } + + + $resourcePath = '/v1/databases/{databaseName}/branches/{branchName}/export/{exportId}/ranges/{rangeNumber}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($databaseName !== null) { + $resourcePath = str_replace( + '{' . 'databaseName' . '}', + ObjectSerializer::toPathValue($databaseName), + $resourcePath + ); + } + // path params + if ($branchName !== null) { + $resourcePath = str_replace( + '{' . 'branchName' . '}', + ObjectSerializer::toPathValue($branchName), + $resourcePath + ); + } + // path params + if ($exportId !== null) { + $resourcePath = str_replace( + '{' . 'exportId' . '}', + ObjectSerializer::toPathValue($exportId), + $resourcePath + ); + } + // path params + if ($rangeNumber !== null) { + $resourcePath = str_replace( + '{' . 'rangeNumber' . '}', + ObjectSerializer::toPathValue($rangeNumber), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + 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/api/src/API/ImportApi.php b/api/src/API/ImportApi.php new file mode 100644 index 0000000..40e6cf1 --- /dev/null +++ b/api/src/API/ImportApi.php @@ -0,0 +1,1486 @@ + [ + 'application/json', + ], + 'deleteImport' => [ + 'application/json', + ], + 'getImport' => [ + 'application/json', + ], + 'updateImport' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createImport + * + * Create a new import + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Litebase\OpenAPI\Model\CreateImport201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function createImport($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + list($response) = $this->createImportWithHttpInfo($importControllerStoreRequest, $contentType); + return $response; + } + + /** + * Operation createImportWithHttpInfo + * + * Create a new import + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Litebase\OpenAPI\Model\CreateImport201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createImportWithHttpInfo($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + $request = $this->createImportRequest($importControllerStoreRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\CreateImport201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 422: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\CreateImport201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\CreateImport201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createImportAsync + * + * Create a new import + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createImportAsync($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + return $this->createImportAsyncWithHttpInfo($importControllerStoreRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createImportAsyncWithHttpInfo + * + * Create a new import + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createImportAsyncWithHttpInfo($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\CreateImport201Response'; + $request = $this->createImportRequest($importControllerStoreRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createImport' + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createImportRequest($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + + // verify the required parameter 'importControllerStoreRequest' is set + if ($importControllerStoreRequest === null || (is_array($importControllerStoreRequest) && count($importControllerStoreRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importControllerStoreRequest when calling createImport' + ); + } + + + $resourcePath = '/v1/imports'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($importControllerStoreRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importControllerStoreRequest)); + } else { + $httpBody = $importControllerStoreRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteImport + * + * Delete an import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Litebase\OpenAPI\Model\DeleteImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function deleteImport($importId, string $contentType = self::contentTypes['deleteImport'][0]) + { + list($response) = $this->deleteImportWithHttpInfo($importId, $contentType); + return $response; + } + + /** + * Operation deleteImportWithHttpInfo + * + * Delete an import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Litebase\OpenAPI\Model\DeleteImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteImportWithHttpInfo($importId, string $contentType = self::contentTypes['deleteImport'][0]) + { + $request = $this->deleteImportRequest($importId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\DeleteImport200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\DeleteImport200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\DeleteImport200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation deleteImportAsync + * + * Delete an import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteImportAsync($importId, string $contentType = self::contentTypes['deleteImport'][0]) + { + return $this->deleteImportAsyncWithHttpInfo($importId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteImportAsyncWithHttpInfo + * + * Delete an import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteImportAsyncWithHttpInfo($importId, string $contentType = self::contentTypes['deleteImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\DeleteImport200Response'; + $request = $this->deleteImportRequest($importId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteImport' + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteImportRequest($importId, string $contentType = self::contentTypes['deleteImport'][0]) + { + + // verify the required parameter 'importId' is set + if ($importId === null || (is_array($importId) && count($importId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importId when calling deleteImport' + ); + } + + + $resourcePath = '/v1/imports/{importId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($importId !== null) { + $resourcePath = str_replace( + '{' . 'importId' . '}', + ObjectSerializer::toPathValue($importId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getImport + * + * Show details of an specific import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Litebase\OpenAPI\Model\GetImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function getImport($importId, string $contentType = self::contentTypes['getImport'][0]) + { + list($response) = $this->getImportWithHttpInfo($importId, $contentType); + return $response; + } + + /** + * Operation getImportWithHttpInfo + * + * Show details of an specific import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Litebase\OpenAPI\Model\GetImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getImportWithHttpInfo($importId, string $contentType = self::contentTypes['getImport'][0]) + { + $request = $this->getImportRequest($importId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\GetImport200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\GetImport200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\GetImport200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation getImportAsync + * + * Show details of an specific import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getImportAsync($importId, string $contentType = self::contentTypes['getImport'][0]) + { + return $this->getImportAsyncWithHttpInfo($importId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getImportAsyncWithHttpInfo + * + * Show details of an specific import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getImportAsyncWithHttpInfo($importId, string $contentType = self::contentTypes['getImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\GetImport200Response'; + $request = $this->getImportRequest($importId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getImport' + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getImportRequest($importId, string $contentType = self::contentTypes['getImport'][0]) + { + + // verify the required parameter 'importId' is set + if ($importId === null || (is_array($importId) && count($importId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importId when calling getImport' + ); + } + + + $resourcePath = '/v1/imports/{importId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($importId !== null) { + $resourcePath = str_replace( + '{' . 'importId' . '}', + ObjectSerializer::toPathValue($importId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateImport + * + * Update an existing import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Litebase\OpenAPI\Model\UpdateImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse + */ + public function updateImport($importId, string $contentType = self::contentTypes['updateImport'][0]) + { + list($response) = $this->updateImportWithHttpInfo($importId, $contentType); + return $response; + } + + /** + * Operation updateImportWithHttpInfo + * + * Update an existing import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Litebase\OpenAPI\Model\UpdateImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateImportWithHttpInfo($importId, string $contentType = self::contentTypes['updateImport'][0]) + { + $request = $this->updateImportRequest($importId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\UpdateImport200Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 422: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\UpdateImport200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\UpdateImport200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation updateImportAsync + * + * Update an existing import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateImportAsync($importId, string $contentType = self::contentTypes['updateImport'][0]) + { + return $this->updateImportAsyncWithHttpInfo($importId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateImportAsyncWithHttpInfo + * + * Update an existing import + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateImportAsyncWithHttpInfo($importId, string $contentType = self::contentTypes['updateImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\UpdateImport200Response'; + $request = $this->updateImportRequest($importId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateImport' + * + * @param string $importId The importId parameter (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateImportRequest($importId, string $contentType = self::contentTypes['updateImport'][0]) + { + + // verify the required parameter 'importId' is set + if ($importId === null || (is_array($importId) && count($importId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importId when calling updateImport' + ); + } + + + $resourcePath = '/v1/imports/{importId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($importId !== null) { + $resourcePath = str_replace( + '{' . 'importId' . '}', + ObjectSerializer::toPathValue($importId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + 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/api/src/API/ImportChunkApi.php b/api/src/API/ImportChunkApi.php new file mode 100644 index 0000000..54b76e9 --- /dev/null +++ b/api/src/API/ImportChunkApi.php @@ -0,0 +1,532 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createImportChunk + * + * Create a new import chunk + * + * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Litebase\OpenAPI\Model\CreateImportChunk201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function createImportChunk($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + list($response) = $this->createImportChunkWithHttpInfo($importId, $importChunkControllerStoreRequest, $contentType); + return $response; + } + + /** + * Operation createImportChunkWithHttpInfo + * + * Create a new import chunk + * + * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Litebase\OpenAPI\Model\CreateImportChunk201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createImportChunkWithHttpInfo($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + $request = $this->createImportChunkRequest($importId, $importChunkControllerStoreRequest, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\CreateImportChunk201Response', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 422: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\CreateImportChunk201Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\CreateImportChunk201Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createImportChunkAsync + * + * Create a new import chunk + * + * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createImportChunkAsync($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + return $this->createImportChunkAsyncWithHttpInfo($importId, $importChunkControllerStoreRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createImportChunkAsyncWithHttpInfo + * + * Create a new import chunk + * + * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createImportChunkAsyncWithHttpInfo($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\CreateImportChunk201Response'; + $request = $this->createImportChunkRequest($importId, $importChunkControllerStoreRequest, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createImportChunk' + * + * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createImportChunkRequest($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + + // verify the required parameter 'importId' is set + if ($importId === null || (is_array($importId) && count($importId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importId when calling createImportChunk' + ); + } + + // verify the required parameter 'importChunkControllerStoreRequest' is set + if ($importChunkControllerStoreRequest === null || (is_array($importChunkControllerStoreRequest) && count($importChunkControllerStoreRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importChunkControllerStoreRequest when calling createImportChunk' + ); + } + + + $resourcePath = '/v1/imports/{importId}/chunks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($importId !== null) { + $resourcePath = str_replace( + '{' . 'importId' . '}', + ObjectSerializer::toPathValue($importId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($importChunkControllerStoreRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importChunkControllerStoreRequest)); + } else { + $httpBody = $importChunkControllerStoreRequest; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + 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/api/src/Model/CreateImport201Response.php b/api/src/Model/CreateImport201Response.php new file mode 100644 index 0000000..b055d6d --- /dev/null +++ b/api/src/Model/CreateImport201Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportControllerStoreResponse', + 'message' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Litebase\OpenAPI\Model\ImportControllerStoreResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportControllerStoreResponse $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/CreateImportChunk201Response.php b/api/src/Model/CreateImportChunk201Response.php new file mode 100644 index 0000000..7e5353e --- /dev/null +++ b/api/src/Model/CreateImportChunk201Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse', + 'message' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/DeleteImport200Response.php b/api/src/Model/DeleteImport200Response.php new file mode 100644 index 0000000..f1b1cd2 --- /dev/null +++ b/api/src/Model/DeleteImport200Response.php @@ -0,0 +1,414 @@ + 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/GetImport200Response.php b/api/src/Model/GetImport200Response.php new file mode 100644 index 0000000..3db7a97 --- /dev/null +++ b/api/src/Model/GetImport200Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportControllerShowResponse', + 'message' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Litebase\OpenAPI\Model\ImportControllerShowResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportControllerShowResponse $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportChunkControllerStoreRequest.php b/api/src/Model/ImportChunkControllerStoreRequest.php new file mode 100644 index 0000000..5230506 --- /dev/null +++ b/api/src/Model/ImportChunkControllerStoreRequest.php @@ -0,0 +1,448 @@ + 'string', + 'chunkData' => 'string', + 'chunkIndex' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'checksum' => null, + 'chunkData' => null, + 'chunkIndex' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'checksum' => false, + 'chunkData' => false, + 'chunkIndex' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'checksum' => 'checksum', + 'chunkData' => 'chunkData', + 'chunkIndex' => 'chunkIndex' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checksum' => 'setChecksum', + 'chunkData' => 'setChunkData', + 'chunkIndex' => 'setChunkIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checksum' => 'getChecksum', + 'chunkData' => 'getChunkData', + 'chunkIndex' => 'getChunkIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('checksum', $data ?? [], null); + $this->setIfExists('chunkData', $data ?? [], null); + $this->setIfExists('chunkIndex', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['chunkData'] === null) { + $invalidProperties[] = "'chunkData' can't be null"; + } + if ($this->container['chunkIndex'] === null) { + $invalidProperties[] = "'chunkIndex' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets checksum + * + * @return string|null + */ + public function getChecksum() + { + return $this->container['checksum']; + } + + /** + * Sets checksum + * + * @param string|null $checksum checksum + * + * @return self + */ + public function setChecksum($checksum) + { + if (is_null($checksum)) { + throw new \InvalidArgumentException('non-nullable checksum cannot be null'); + } + $this->container['checksum'] = $checksum; + + return $this; + } + + /** + * Gets chunkData + * + * @return string + */ + public function getChunkData() + { + return $this->container['chunkData']; + } + + /** + * Sets chunkData + * + * @param string $chunkData chunkData + * + * @return self + */ + public function setChunkData($chunkData) + { + if (is_null($chunkData)) { + throw new \InvalidArgumentException('non-nullable chunkData cannot be null'); + } + $this->container['chunkData'] = $chunkData; + + return $this; + } + + /** + * Gets chunkIndex + * + * @return int + */ + public function getChunkIndex() + { + return $this->container['chunkIndex']; + } + + /** + * Sets chunkIndex + * + * @param int $chunkIndex chunkIndex + * + * @return self + */ + public function setChunkIndex($chunkIndex) + { + if (is_null($chunkIndex)) { + throw new \InvalidArgumentException('non-nullable chunkIndex cannot be null'); + } + $this->container['chunkIndex'] = $chunkIndex; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportChunkControllerStoreResponse.php b/api/src/Model/ImportChunkControllerStoreResponse.php new file mode 100644 index 0000000..212a6dc --- /dev/null +++ b/api/src/Model/ImportChunkControllerStoreResponse.php @@ -0,0 +1,442 @@ + 'int', + 'importId' => 'int', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'chunkIndex' => null, + 'importId' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'chunkIndex' => false, + 'importId' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'chunkIndex' => 'chunkIndex', + 'importId' => 'importId', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'chunkIndex' => 'setChunkIndex', + 'importId' => 'setImportId', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'chunkIndex' => 'getChunkIndex', + 'importId' => 'getImportId', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('chunkIndex', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets chunkIndex + * + * @return int|null + */ + public function getChunkIndex() + { + return $this->container['chunkIndex']; + } + + /** + * Sets chunkIndex + * + * @param int|null $chunkIndex chunkIndex + * + * @return self + */ + public function setChunkIndex($chunkIndex) + { + if (is_null($chunkIndex)) { + throw new \InvalidArgumentException('non-nullable chunkIndex cannot be null'); + } + $this->container['chunkIndex'] = $chunkIndex; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportControllerShowResponse.php b/api/src/Model/ImportControllerShowResponse.php new file mode 100644 index 0000000..7de1159 --- /dev/null +++ b/api/src/Model/ImportControllerShowResponse.php @@ -0,0 +1,748 @@ + 'string', + 'chunkCount' => 'int', + 'completedAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'databaseId' => 'string', + 'databaseName' => 'string', + 'importId' => 'int', + 'missingChunks' => 'int[]', + 'status' => 'string', + 'totalSize' => 'int', + 'updatedAt' => '\DateTime', + 'uploadedChunks' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'completedAt' => 'date-time', + 'createdAt' => 'date-time', + 'databaseId' => null, + 'databaseName' => null, + 'importId' => null, + 'missingChunks' => null, + 'status' => null, + 'totalSize' => null, + 'updatedAt' => 'date-time', + 'uploadedChunks' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'completedAt' => false, + 'createdAt' => false, + 'databaseId' => false, + 'databaseName' => false, + 'importId' => false, + 'missingChunks' => false, + 'status' => false, + 'totalSize' => false, + 'updatedAt' => false, + 'uploadedChunks' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'completedAt' => 'completedAt', + 'createdAt' => 'createdAt', + 'databaseId' => 'databaseId', + 'databaseName' => 'databaseName', + 'importId' => 'importId', + 'missingChunks' => 'missingChunks', + 'status' => 'status', + 'totalSize' => 'totalSize', + 'updatedAt' => 'updatedAt', + 'uploadedChunks' => 'uploadedChunks' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'completedAt' => 'setCompletedAt', + 'createdAt' => 'setCreatedAt', + 'databaseId' => 'setDatabaseId', + 'databaseName' => 'setDatabaseName', + 'importId' => 'setImportId', + 'missingChunks' => 'setMissingChunks', + 'status' => 'setStatus', + 'totalSize' => 'setTotalSize', + 'updatedAt' => 'setUpdatedAt', + 'uploadedChunks' => 'setUploadedChunks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'completedAt' => 'getCompletedAt', + 'createdAt' => 'getCreatedAt', + 'databaseId' => 'getDatabaseId', + 'databaseName' => 'getDatabaseName', + 'importId' => 'getImportId', + 'missingChunks' => 'getMissingChunks', + 'status' => 'getStatus', + 'totalSize' => 'getTotalSize', + 'updatedAt' => 'getUpdatedAt', + 'uploadedChunks' => 'getUploadedChunks' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('completedAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('databaseId', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('missingChunks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('totalSize', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('uploadedChunks', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int|null + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int|null $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets completedAt + * + * @return \DateTime|null + */ + public function getCompletedAt() + { + return $this->container['completedAt']; + } + + /** + * Sets completedAt + * + * @param \DateTime|null $completedAt completedAt + * + * @return self + */ + public function setCompletedAt($completedAt) + { + if (is_null($completedAt)) { + throw new \InvalidArgumentException('non-nullable completedAt cannot be null'); + } + $this->container['completedAt'] = $completedAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Creation timestamp + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets databaseId + * + * @return string|null + */ + public function getDatabaseId() + { + return $this->container['databaseId']; + } + + /** + * Sets databaseId + * + * @param string|null $databaseId databaseId + * + * @return self + */ + public function setDatabaseId($databaseId) + { + if (is_null($databaseId)) { + throw new \InvalidArgumentException('non-nullable databaseId cannot be null'); + } + $this->container['databaseId'] = $databaseId; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets missingChunks + * + * @return int[]|null + */ + public function getMissingChunks() + { + return $this->container['missingChunks']; + } + + /** + * Sets missingChunks + * + * @param int[]|null $missingChunks missingChunks + * + * @return self + */ + public function setMissingChunks($missingChunks) + { + if (is_null($missingChunks)) { + throw new \InvalidArgumentException('non-nullable missingChunks cannot be null'); + } + $this->container['missingChunks'] = $missingChunks; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets totalSize + * + * @return int|null + */ + public function getTotalSize() + { + return $this->container['totalSize']; + } + + /** + * Sets totalSize + * + * @param int|null $totalSize totalSize + * + * @return self + */ + public function setTotalSize($totalSize) + { + if (is_null($totalSize)) { + throw new \InvalidArgumentException('non-nullable totalSize cannot be null'); + } + $this->container['totalSize'] = $totalSize; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Last update timestamp + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets uploadedChunks + * + * @return int|null + */ + public function getUploadedChunks() + { + return $this->container['uploadedChunks']; + } + + /** + * Sets uploadedChunks + * + * @param int|null $uploadedChunks uploadedChunks + * + * @return self + */ + public function setUploadedChunks($uploadedChunks) + { + if (is_null($uploadedChunks)) { + throw new \InvalidArgumentException('non-nullable uploadedChunks cannot be null'); + } + $this->container['uploadedChunks'] = $uploadedChunks; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportControllerStoreRequest.php b/api/src/Model/ImportControllerStoreRequest.php new file mode 100644 index 0000000..76b2884 --- /dev/null +++ b/api/src/Model/ImportControllerStoreRequest.php @@ -0,0 +1,448 @@ + 'string', + 'chunkCount' => 'int', + 'databaseName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'databaseName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'databaseName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'databaseName' => 'databaseName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'databaseName' => 'setDatabaseName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'databaseName' => 'getDatabaseName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['chunkCount'] === null) { + $invalidProperties[] = "'chunkCount' can't be null"; + } + if ($this->container['databaseName'] === null) { + $invalidProperties[] = "'databaseName' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets databaseName + * + * @return string + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportControllerStoreResponse.php b/api/src/Model/ImportControllerStoreResponse.php new file mode 100644 index 0000000..9c6855f --- /dev/null +++ b/api/src/Model/ImportControllerStoreResponse.php @@ -0,0 +1,578 @@ + 'string', + 'chunkCount' => 'int', + 'createdAt' => '\DateTime', + 'databaseId' => 'string', + 'databaseName' => 'string', + 'importId' => 'int', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'createdAt' => 'date-time', + 'databaseId' => null, + 'databaseName' => null, + 'importId' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'createdAt' => false, + 'databaseId' => false, + 'databaseName' => false, + 'importId' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'createdAt' => 'createdAt', + 'databaseId' => 'databaseId', + 'databaseName' => 'databaseName', + 'importId' => 'importId', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'createdAt' => 'setCreatedAt', + 'databaseId' => 'setDatabaseId', + 'databaseName' => 'setDatabaseName', + 'importId' => 'setImportId', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'createdAt' => 'getCreatedAt', + 'databaseId' => 'getDatabaseId', + 'databaseName' => 'getDatabaseName', + 'importId' => 'getImportId', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('databaseId', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int|null + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int|null $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Creation timestamp + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets databaseId + * + * @return string|null + */ + public function getDatabaseId() + { + return $this->container['databaseId']; + } + + /** + * Sets databaseId + * + * @param string|null $databaseId databaseId + * + * @return self + */ + public function setDatabaseId($databaseId) + { + if (is_null($databaseId)) { + throw new \InvalidArgumentException('non-nullable databaseId cannot be null'); + } + $this->container['databaseId'] = $databaseId; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/Privilege.php b/api/src/Model/Privilege.php index b789d56..78913cd 100644 --- a/api/src/Model/Privilege.php +++ b/api/src/Model/Privilege.php @@ -38,6 +38,10 @@ class Privilege public const DATABASE_RESTORE = 'database:restore'; + public const DATABASE_EXPORT = 'database:export'; + + public const DATABASE_IMPORT = 'database:import'; + public const DATABASE_QUERY = 'database:query'; public const DATABASE_ANALYZE = 'database:analyze'; @@ -128,6 +132,8 @@ public static function getAllowableEnumValues() self::DATABASE_BRANCH_MANAGE, self::DATABASE_BACKUP, self::DATABASE_RESTORE, + self::DATABASE_EXPORT, + self::DATABASE_IMPORT, self::DATABASE_QUERY, self::DATABASE_ANALYZE, self::DATABASE_ATTACH, diff --git a/api/src/Model/UpdateImport200Response.php b/api/src/Model/UpdateImport200Response.php new file mode 100644 index 0000000..8476f49 --- /dev/null +++ b/api/src/Model/UpdateImport200Response.php @@ -0,0 +1,414 @@ + 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + From 021e68b6dd47efb3e6a92b47b3f0ddc3bf2c6561 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Fri, 19 Dec 2025 15:56:58 -0500 Subject: [PATCH 2/4] Add export and import API accessors to ApiClient Introduces methods and imports for DatabaseExportApi, DatabaseExportPartApi, ImportApi, and ImportChunkApi in the ApiClient class, enabling access to new export and import functionalities. --- src/ApiClient.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ApiClient.php b/src/ApiClient.php index d43b06c..00b32b6 100644 --- a/src/ApiClient.php +++ b/src/ApiClient.php @@ -12,8 +12,12 @@ use Litebase\OpenAPI\API\DatabaseApi; use Litebase\OpenAPI\API\DatabaseBackupApi; use Litebase\OpenAPI\API\DatabaseBranchApi; +use Litebase\OpenAPI\API\DatabaseExportApi; +use Litebase\OpenAPI\API\DatabaseExportPartApi; use Litebase\OpenAPI\API\DatabaseRestoreApi; use Litebase\OpenAPI\API\DatabaseSnapshotApi; +use Litebase\OpenAPI\API\ImportApi; +use Litebase\OpenAPI\API\ImportChunkApi; use Litebase\OpenAPI\API\KeyActivateApi; use Litebase\OpenAPI\API\KeyApi; use Litebase\OpenAPI\API\QueryApi; @@ -102,6 +106,16 @@ public function databaseBranch(): DatabaseBranchApi return new DatabaseBranchApi($this->getHttpClient(), $this->config); } + public function databaseExport(): DatabaseExportApi + { + return new DatabaseExportApi($this->getHttpClient(), $this->config); + } + + public function databaseExportPart(): DatabaseExportPartApi + { + return new DatabaseExportPartApi($this->getHttpClient(), $this->config); + } + public function databaseRestore(): DatabaseRestoreApi { return new DatabaseRestoreApi($this->getHttpClient(), $this->config); @@ -112,6 +126,16 @@ public function databaseSnapshot(): DatabaseSnapshotApi return new DatabaseSnapshotApi($this->getHttpClient(), $this->config); } + public function import(): ImportApi + { + return new ImportApi($this->getHttpClient(), $this->config); + } + + public function importChunk(): ImportChunkApi + { + return new ImportChunkApi($this->getHttpClient(), $this->config); + } + public function key(): KeyApi { return new KeyApi($this->getHttpClient(), $this->config); From f8013534d7006fc6b7bc22d6a5bfb468212337eb Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Tue, 6 Jan 2026 11:25:42 -0500 Subject: [PATCH 3/4] Add database export end API and update import models Introduces DatabaseExportEndApi and related response models for handling database export completion. Updates ImportApi and ImportChunkApi to use new ImportStoreRequest and ImportChunkStoreRequest models, and refines response types for database export and import operations. Also updates openapi_config.yaml and integration tests to reflect these changes. --- api/src/API/DatabaseExportApi.php | 12 +- api/src/API/DatabaseExportEndApi.php | 558 +++++++++++++ api/src/API/DatabaseExportPartApi.php | 2 +- api/src/API/ImportApi.php | 79 +- api/src/API/ImportChunkApi.php | 40 +- .../Model/CreateDatabaseExport200Response.php | 451 +++++++++++ api/src/Model/CreateImport201Response.php | 6 +- .../Model/CreateImportChunk201Response.php | 6 +- api/src/Model/CreateUser201Response.php | 6 +- .../DatabaseExportControllerStoreResponse.php | 578 ++++++++++++++ api/src/Model/DatabaseExportStoreResponse.php | 578 ++++++++++++++ api/src/Model/GetImport200Response.php | 6 +- api/src/Model/GetToken200Response.php | 6 +- api/src/Model/GetUser200Response.php | 6 +- api/src/Model/ImportChunkStoreRequest.php | 448 +++++++++++ api/src/Model/ImportChunkStoreResponse.php | 442 +++++++++++ api/src/Model/ImportShowResponse.php | 748 ++++++++++++++++++ api/src/Model/ImportStoreRequest.php | 448 +++++++++++ api/src/Model/ImportStoreResponse.php | 578 ++++++++++++++ api/src/Model/ImportUpdateRequest.php | 448 +++++++++++ api/src/Model/ImportUpdateResponse.php | 578 ++++++++++++++ api/src/Model/TokenShowResponse.php | 510 ++++++++++++ api/src/Model/UpdateImport200Response.php | 37 + api/src/Model/UpdateUser200Response.php | 6 +- api/src/Model/UserShowResponse.php | 510 ++++++++++++ api/src/Model/UserStoreResponse.php | 510 ++++++++++++ api/src/Model/UserUpdateResponse.php | 510 ++++++++++++ src/ApiClient.php | 6 + 28 files changed, 8035 insertions(+), 78 deletions(-) create mode 100644 api/src/API/DatabaseExportEndApi.php create mode 100644 api/src/Model/CreateDatabaseExport200Response.php create mode 100644 api/src/Model/DatabaseExportControllerStoreResponse.php create mode 100644 api/src/Model/DatabaseExportStoreResponse.php create mode 100644 api/src/Model/ImportChunkStoreRequest.php create mode 100644 api/src/Model/ImportChunkStoreResponse.php create mode 100644 api/src/Model/ImportShowResponse.php create mode 100644 api/src/Model/ImportStoreRequest.php create mode 100644 api/src/Model/ImportStoreResponse.php create mode 100644 api/src/Model/ImportUpdateRequest.php create mode 100644 api/src/Model/ImportUpdateResponse.php create mode 100644 api/src/Model/TokenShowResponse.php create mode 100644 api/src/Model/UserShowResponse.php create mode 100644 api/src/Model/UserStoreResponse.php create mode 100644 api/src/Model/UserUpdateResponse.php diff --git a/api/src/API/DatabaseExportApi.php b/api/src/API/DatabaseExportApi.php index 40a955e..6b8c74b 100644 --- a/api/src/API/DatabaseExportApi.php +++ b/api/src/API/DatabaseExportApi.php @@ -116,7 +116,7 @@ public function getConfig() * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + * @return \Litebase\OpenAPI\Model\CreateDatabaseExport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse */ public function createDatabaseExport($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) { @@ -136,7 +136,7 @@ public function createDatabaseExport($databaseName, $branchName, $body, string $ * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Litebase\OpenAPI\Model\CreateDatabaseExport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) */ public function createDatabaseExportWithHttpInfo($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) { @@ -168,7 +168,7 @@ public function createDatabaseExportWithHttpInfo($databaseName, $branchName, $bo switch($statusCode) { case 200: return $this->handleResponseWithDataType( - 'object', + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', $request, $response, ); @@ -202,7 +202,7 @@ public function createDatabaseExportWithHttpInfo($databaseName, $branchName, $bo } return $this->handleResponseWithDataType( - 'object', + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', $request, $response, ); @@ -211,7 +211,7 @@ public function createDatabaseExportWithHttpInfo($databaseName, $branchName, $bo case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'object', + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -277,7 +277,7 @@ function ($response) { */ public function createDatabaseExportAsyncWithHttpInfo($databaseName, $branchName, $body, string $contentType = self::contentTypes['createDatabaseExport'][0]) { - $returnType = 'object'; + $returnType = '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response'; $request = $this->createDatabaseExportRequest($databaseName, $branchName, $body, $contentType); return $this->client diff --git a/api/src/API/DatabaseExportEndApi.php b/api/src/API/DatabaseExportEndApi.php new file mode 100644 index 0000000..0177ecd --- /dev/null +++ b/api/src/API/DatabaseExportEndApi.php @@ -0,0 +1,558 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createDatabaseExportEnd + * + * Create a new database export end + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param object $body Database export end creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExportEnd'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse + */ + public function createDatabaseExportEnd($databaseName, $branchName, $exportId, $body, string $contentType = self::contentTypes['createDatabaseExportEnd'][0]) + { + list($response) = $this->createDatabaseExportEndWithHttpInfo($databaseName, $branchName, $exportId, $body, $contentType); + return $response; + } + + /** + * Operation createDatabaseExportEndWithHttpInfo + * + * Create a new database export end + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param object $body Database export end creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExportEnd'] to see the possible values for this operation + * + * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of object|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createDatabaseExportEndWithHttpInfo($databaseName, $branchName, $exportId, $body, string $contentType = self::contentTypes['createDatabaseExportEnd'][0]) + { + $request = $this->createDatabaseExportEndRequest($databaseName, $branchName, $exportId, $body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch ($statusCode) { + case 200: + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Litebase\OpenAPI\Model\ErrorResponse', + $request, + $response, + ); + } + + + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + 'object', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\ErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + + throw $e; + } + } + + /** + * Operation createDatabaseExportEndAsync + * + * Create a new database export end + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param object $body Database export end creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExportEnd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDatabaseExportEndAsync($databaseName, $branchName, $exportId, $body, string $contentType = self::contentTypes['createDatabaseExportEnd'][0]) + { + return $this->createDatabaseExportEndAsyncWithHttpInfo($databaseName, $branchName, $exportId, $body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDatabaseExportEndAsyncWithHttpInfo + * + * Create a new database export end + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param object $body Database export end creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExportEnd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDatabaseExportEndAsyncWithHttpInfo($databaseName, $branchName, $exportId, $body, string $contentType = self::contentTypes['createDatabaseExportEnd'][0]) + { + $returnType = 'object'; + $request = $this->createDatabaseExportEndRequest($databaseName, $branchName, $exportId, $body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createDatabaseExportEnd' + * + * @param string $databaseName The databaseName parameter (required) + * @param string $branchName The branchName parameter (required) + * @param string $exportId The exportId parameter (required) + * @param object $body Database export end creation data (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDatabaseExportEnd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDatabaseExportEndRequest($databaseName, $branchName, $exportId, $body, string $contentType = self::contentTypes['createDatabaseExportEnd'][0]) + { + + // verify the required parameter 'databaseName' is set + if ($databaseName === null || (is_array($databaseName) && count($databaseName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $databaseName when calling createDatabaseExportEnd' + ); + } + + // verify the required parameter 'branchName' is set + if ($branchName === null || (is_array($branchName) && count($branchName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $branchName when calling createDatabaseExportEnd' + ); + } + + // verify the required parameter 'exportId' is set + if ($exportId === null || (is_array($exportId) && count($exportId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exportId when calling createDatabaseExportEnd' + ); + } + + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createDatabaseExportEnd' + ); + } + + + $resourcePath = '/v1/databases/{databaseName}/branches/{branchName}/export/{exportId}/end'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($databaseName !== null) { + $resourcePath = str_replace( + '{' . 'databaseName' . '}', + ObjectSerializer::toPathValue($databaseName), + $resourcePath + ); + } + // path params + if ($branchName !== null) { + $resourcePath = str_replace( + '{' . 'branchName' . '}', + ObjectSerializer::toPathValue($branchName), + $resourcePath + ); + } + // path params + if ($exportId !== null) { + $resourcePath = str_replace( + '{' . 'exportId' . '}', + ObjectSerializer::toPathValue($exportId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json',], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + 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/api/src/API/DatabaseExportPartApi.php b/api/src/API/DatabaseExportPartApi.php index 12a7532..664256a 100644 --- a/api/src/API/DatabaseExportPartApi.php +++ b/api/src/API/DatabaseExportPartApi.php @@ -436,7 +436,7 @@ public function getDatabaseExportPartRequest($databaseName, $branchName, $export $headers = $this->headerSelector->selectHeaders( - ['application/json', ], + ['application/octet-stream', 'application/json', ], $contentType, $multipart ); diff --git a/api/src/API/ImportApi.php b/api/src/API/ImportApi.php index 40e6cf1..7349830 100644 --- a/api/src/API/ImportApi.php +++ b/api/src/API/ImportApi.php @@ -118,16 +118,16 @@ public function getConfig() * * Create a new import * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param \Litebase\OpenAPI\Model\ImportStoreRequest $importStoreRequest Import creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Litebase\OpenAPI\Model\CreateImport201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse */ - public function createImport($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + public function createImport($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) { - list($response) = $this->createImportWithHttpInfo($importControllerStoreRequest, $contentType); + list($response) = $this->createImportWithHttpInfo($importStoreRequest, $contentType); return $response; } @@ -136,16 +136,16 @@ public function createImport($importControllerStoreRequest, string $contentType * * Create a new import * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param \Litebase\OpenAPI\Model\ImportStoreRequest $importStoreRequest Import creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Litebase\OpenAPI\Model\CreateImport201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) */ - public function createImportWithHttpInfo($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + public function createImportWithHttpInfo($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) { - $request = $this->createImportRequest($importControllerStoreRequest, $contentType); + $request = $this->createImportRequest($importStoreRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -277,15 +277,15 @@ public function createImportWithHttpInfo($importControllerStoreRequest, string $ * * Create a new import * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param \Litebase\OpenAPI\Model\ImportStoreRequest $importStoreRequest Import creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createImportAsync($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + public function createImportAsync($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) { - return $this->createImportAsyncWithHttpInfo($importControllerStoreRequest, $contentType) + return $this->createImportAsyncWithHttpInfo($importStoreRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -298,16 +298,16 @@ function ($response) { * * Create a new import * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param \Litebase\OpenAPI\Model\ImportStoreRequest $importStoreRequest Import creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createImportAsyncWithHttpInfo($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + public function createImportAsyncWithHttpInfo($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) { $returnType = '\Litebase\OpenAPI\Model\CreateImport201Response'; - $request = $this->createImportRequest($importControllerStoreRequest, $contentType); + $request = $this->createImportRequest($importStoreRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -348,19 +348,19 @@ function ($exception) { /** * Create request for operation 'createImport' * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreRequest $importControllerStoreRequest Import creation data (required) + * @param \Litebase\OpenAPI\Model\ImportStoreRequest $importStoreRequest Import creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createImportRequest($importControllerStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + public function createImportRequest($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) { - // verify the required parameter 'importControllerStoreRequest' is set - if ($importControllerStoreRequest === null || (is_array($importControllerStoreRequest) && count($importControllerStoreRequest) === 0)) { + // verify the required parameter 'importStoreRequest' is set + if ($importStoreRequest === null || (is_array($importStoreRequest) && count($importStoreRequest) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $importControllerStoreRequest when calling createImport' + 'Missing the required parameter $importStoreRequest when calling createImport' ); } @@ -383,12 +383,12 @@ public function createImportRequest($importControllerStoreRequest, string $conte ); // for model (json/xml) - if (isset($importControllerStoreRequest)) { + if (isset($importStoreRequest)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importControllerStoreRequest)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importStoreRequest)); } else { - $httpBody = $importControllerStoreRequest; + $httpBody = $importStoreRequest; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1111,15 +1111,16 @@ public function getImportRequest($importId, string $contentType = self::contentT * Update an existing import * * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportUpdateRequest $importUpdateRequest Import update data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Litebase\OpenAPI\Model\UpdateImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse */ - public function updateImport($importId, string $contentType = self::contentTypes['updateImport'][0]) + public function updateImport($importId, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) { - list($response) = $this->updateImportWithHttpInfo($importId, $contentType); + list($response) = $this->updateImportWithHttpInfo($importId, $importUpdateRequest, $contentType); return $response; } @@ -1129,15 +1130,16 @@ public function updateImport($importId, string $contentType = self::contentTypes * Update an existing import * * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportUpdateRequest $importUpdateRequest Import update data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Litebase\OpenAPI\Model\UpdateImport200Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse, HTTP status code, HTTP response headers (array of strings) */ - public function updateImportWithHttpInfo($importId, string $contentType = self::contentTypes['updateImport'][0]) + public function updateImportWithHttpInfo($importId, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) { - $request = $this->updateImportRequest($importId, $contentType); + $request = $this->updateImportRequest($importId, $importUpdateRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -1256,14 +1258,15 @@ public function updateImportWithHttpInfo($importId, string $contentType = self:: * Update an existing import * * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportUpdateRequest $importUpdateRequest Import update data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateImportAsync($importId, string $contentType = self::contentTypes['updateImport'][0]) + public function updateImportAsync($importId, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) { - return $this->updateImportAsyncWithHttpInfo($importId, $contentType) + return $this->updateImportAsyncWithHttpInfo($importId, $importUpdateRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -1277,15 +1280,16 @@ function ($response) { * Update an existing import * * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportUpdateRequest $importUpdateRequest Import update data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateImportAsyncWithHttpInfo($importId, string $contentType = self::contentTypes['updateImport'][0]) + public function updateImportAsyncWithHttpInfo($importId, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) { $returnType = '\Litebase\OpenAPI\Model\UpdateImport200Response'; - $request = $this->updateImportRequest($importId, $contentType); + $request = $this->updateImportRequest($importId, $importUpdateRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1327,12 +1331,13 @@ function ($exception) { * Create request for operation 'updateImport' * * @param string $importId The importId parameter (required) + * @param \Litebase\OpenAPI\Model\ImportUpdateRequest $importUpdateRequest Import update data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateImport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateImportRequest($importId, string $contentType = self::contentTypes['updateImport'][0]) + public function updateImportRequest($importId, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) { // verify the required parameter 'importId' is set @@ -1342,6 +1347,13 @@ public function updateImportRequest($importId, string $contentType = self::conte ); } + // verify the required parameter 'importUpdateRequest' is set + if ($importUpdateRequest === null || (is_array($importUpdateRequest) && count($importUpdateRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importUpdateRequest when calling updateImport' + ); + } + $resourcePath = '/v1/imports/{importId}'; $formParams = []; @@ -1369,7 +1381,14 @@ public function updateImportRequest($importId, string $contentType = self::conte ); // for model (json/xml) - if (count($formParams) > 0) { + if (isset($importUpdateRequest)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importUpdateRequest)); + } else { + $httpBody = $importUpdateRequest; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { diff --git a/api/src/API/ImportChunkApi.php b/api/src/API/ImportChunkApi.php index 54b76e9..768a9d2 100644 --- a/api/src/API/ImportChunkApi.php +++ b/api/src/API/ImportChunkApi.php @@ -110,16 +110,16 @@ public function getConfig() * Create a new import chunk * * @param string $importId The importId parameter (required) - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param \Litebase\OpenAPI\Model\ImportChunkStoreRequest $importChunkStoreRequest Import chunk creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Litebase\OpenAPI\Model\CreateImportChunk201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse */ - public function createImportChunk($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + public function createImportChunk($importId, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) { - list($response) = $this->createImportChunkWithHttpInfo($importId, $importChunkControllerStoreRequest, $contentType); + list($response) = $this->createImportChunkWithHttpInfo($importId, $importChunkStoreRequest, $contentType); return $response; } @@ -129,16 +129,16 @@ public function createImportChunk($importId, $importChunkControllerStoreRequest, * Create a new import chunk * * @param string $importId The importId parameter (required) - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param \Litebase\OpenAPI\Model\ImportChunkStoreRequest $importChunkStoreRequest Import chunk creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation * * @throws \Litebase\OpenAPI\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Litebase\OpenAPI\Model\CreateImportChunk201Response|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse|\Litebase\OpenAPI\Model\ValidationErrorResponse|\Litebase\OpenAPI\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) */ - public function createImportChunkWithHttpInfo($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + public function createImportChunkWithHttpInfo($importId, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) { - $request = $this->createImportChunkRequest($importId, $importChunkControllerStoreRequest, $contentType); + $request = $this->createImportChunkRequest($importId, $importChunkStoreRequest, $contentType); try { $options = $this->createHttpClientOption(); @@ -285,15 +285,15 @@ public function createImportChunkWithHttpInfo($importId, $importChunkControllerS * Create a new import chunk * * @param string $importId The importId parameter (required) - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param \Litebase\OpenAPI\Model\ImportChunkStoreRequest $importChunkStoreRequest Import chunk creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createImportChunkAsync($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + public function createImportChunkAsync($importId, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) { - return $this->createImportChunkAsyncWithHttpInfo($importId, $importChunkControllerStoreRequest, $contentType) + return $this->createImportChunkAsyncWithHttpInfo($importId, $importChunkStoreRequest, $contentType) ->then( function ($response) { return $response[0]; @@ -307,16 +307,16 @@ function ($response) { * Create a new import chunk * * @param string $importId The importId parameter (required) - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param \Litebase\OpenAPI\Model\ImportChunkStoreRequest $importChunkStoreRequest Import chunk creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createImportChunkAsyncWithHttpInfo($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + public function createImportChunkAsyncWithHttpInfo($importId, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) { $returnType = '\Litebase\OpenAPI\Model\CreateImportChunk201Response'; - $request = $this->createImportChunkRequest($importId, $importChunkControllerStoreRequest, $contentType); + $request = $this->createImportChunkRequest($importId, $importChunkStoreRequest, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -358,13 +358,13 @@ function ($exception) { * Create request for operation 'createImportChunk' * * @param string $importId The importId parameter (required) - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreRequest $importChunkControllerStoreRequest Import chunk creation data (required) + * @param \Litebase\OpenAPI\Model\ImportChunkStoreRequest $importChunkStoreRequest Import chunk creation data (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createImportChunk'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createImportChunkRequest($importId, $importChunkControllerStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + public function createImportChunkRequest($importId, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) { // verify the required parameter 'importId' is set @@ -374,10 +374,10 @@ public function createImportChunkRequest($importId, $importChunkControllerStoreR ); } - // verify the required parameter 'importChunkControllerStoreRequest' is set - if ($importChunkControllerStoreRequest === null || (is_array($importChunkControllerStoreRequest) && count($importChunkControllerStoreRequest) === 0)) { + // verify the required parameter 'importChunkStoreRequest' is set + if ($importChunkStoreRequest === null || (is_array($importChunkStoreRequest) && count($importChunkStoreRequest) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $importChunkControllerStoreRequest when calling createImportChunk' + 'Missing the required parameter $importChunkStoreRequest when calling createImportChunk' ); } @@ -408,12 +408,12 @@ public function createImportChunkRequest($importId, $importChunkControllerStoreR ); // for model (json/xml) - if (isset($importChunkControllerStoreRequest)) { + if (isset($importChunkStoreRequest)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importChunkControllerStoreRequest)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($importChunkStoreRequest)); } else { - $httpBody = $importChunkControllerStoreRequest; + $httpBody = $importChunkStoreRequest; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/api/src/Model/CreateDatabaseExport200Response.php b/api/src/Model/CreateDatabaseExport200Response.php new file mode 100644 index 0000000..7c84dd7 --- /dev/null +++ b/api/src/Model/CreateDatabaseExport200Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\DatabaseExportStoreResponse', + 'message' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'message' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'message' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'message' => 'message', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'message' => 'setMessage', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'message' => 'getMessage', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Litebase\OpenAPI\Model\DatabaseExportStoreResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\DatabaseExportStoreResponse $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message Response message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status Response status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/CreateImport201Response.php b/api/src/Model/CreateImport201Response.php index b055d6d..ad377cf 100644 --- a/api/src/Model/CreateImport201Response.php +++ b/api/src/Model/CreateImport201Response.php @@ -22,7 +22,7 @@ class CreateImport201Response implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\ImportControllerStoreResponse', + 'data' => '\Litebase\OpenAPI\Model\ImportStoreResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\ImportControllerStoreResponse + * @return \Litebase\OpenAPI\Model\ImportStoreResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\ImportControllerStoreResponse $data data + * @param \Litebase\OpenAPI\Model\ImportStoreResponse $data data * * @return self */ diff --git a/api/src/Model/CreateImportChunk201Response.php b/api/src/Model/CreateImportChunk201Response.php index 7e5353e..cd733ca 100644 --- a/api/src/Model/CreateImportChunk201Response.php +++ b/api/src/Model/CreateImportChunk201Response.php @@ -22,7 +22,7 @@ class CreateImportChunk201Response implements ModelInterface, ArrayAccess, \Json * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse', + 'data' => '\Litebase\OpenAPI\Model\ImportChunkStoreResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse + * @return \Litebase\OpenAPI\Model\ImportChunkStoreResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\ImportChunkControllerStoreResponse $data data + * @param \Litebase\OpenAPI\Model\ImportChunkStoreResponse $data data * * @return self */ diff --git a/api/src/Model/CreateUser201Response.php b/api/src/Model/CreateUser201Response.php index 7ceb2e7..aadc5a4 100644 --- a/api/src/Model/CreateUser201Response.php +++ b/api/src/Model/CreateUser201Response.php @@ -22,7 +22,7 @@ class CreateUser201Response implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\UserControllerStoreResponse', + 'data' => '\Litebase\OpenAPI\Model\UserStoreResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\UserControllerStoreResponse + * @return \Litebase\OpenAPI\Model\UserStoreResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\UserControllerStoreResponse $data data + * @param \Litebase\OpenAPI\Model\UserStoreResponse $data data * * @return self */ diff --git a/api/src/Model/DatabaseExportControllerStoreResponse.php b/api/src/Model/DatabaseExportControllerStoreResponse.php new file mode 100644 index 0000000..82069fa --- /dev/null +++ b/api/src/Model/DatabaseExportControllerStoreResponse.php @@ -0,0 +1,578 @@ + 'string', + 'databaseName' => 'string', + 'expiresAt' => '\DateTime', + 'id' => 'string', + 'rangeCount' => 'int', + 'ranges' => 'int[]', + 'startedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'databaseBranchName' => null, + 'databaseName' => null, + 'expiresAt' => 'date-time', + 'id' => null, + 'rangeCount' => null, + 'ranges' => null, + 'startedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'databaseBranchName' => false, + 'databaseName' => false, + 'expiresAt' => false, + 'id' => false, + 'rangeCount' => false, + 'ranges' => false, + 'startedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'databaseBranchName' => 'databaseBranchName', + 'databaseName' => 'databaseName', + 'expiresAt' => 'expiresAt', + 'id' => 'id', + 'rangeCount' => 'rangeCount', + 'ranges' => 'ranges', + 'startedAt' => 'startedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'databaseBranchName' => 'setDatabaseBranchName', + 'databaseName' => 'setDatabaseName', + 'expiresAt' => 'setExpiresAt', + 'id' => 'setId', + 'rangeCount' => 'setRangeCount', + 'ranges' => 'setRanges', + 'startedAt' => 'setStartedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'databaseBranchName' => 'getDatabaseBranchName', + 'databaseName' => 'getDatabaseName', + 'expiresAt' => 'getExpiresAt', + 'id' => 'getId', + 'rangeCount' => 'getRangeCount', + 'ranges' => 'getRanges', + 'startedAt' => 'getStartedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('databaseBranchName', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('expiresAt', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rangeCount', $data ?? [], null); + $this->setIfExists('ranges', $data ?? [], null); + $this->setIfExists('startedAt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets databaseBranchName + * + * @return string|null + */ + public function getDatabaseBranchName() + { + return $this->container['databaseBranchName']; + } + + /** + * Sets databaseBranchName + * + * @param string|null $databaseBranchName databaseBranchName + * + * @return self + */ + public function setDatabaseBranchName($databaseBranchName) + { + if (is_null($databaseBranchName)) { + throw new \InvalidArgumentException('non-nullable databaseBranchName cannot be null'); + } + $this->container['databaseBranchName'] = $databaseBranchName; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets expiresAt + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expiresAt']; + } + + /** + * Sets expiresAt + * + * @param \DateTime|null $expiresAt expiresAt + * + * @return self + */ + public function setExpiresAt($expiresAt) + { + if (is_null($expiresAt)) { + throw new \InvalidArgumentException('non-nullable expiresAt cannot be null'); + } + $this->container['expiresAt'] = $expiresAt; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rangeCount + * + * @return int|null + */ + public function getRangeCount() + { + return $this->container['rangeCount']; + } + + /** + * Sets rangeCount + * + * @param int|null $rangeCount rangeCount + * + * @return self + */ + public function setRangeCount($rangeCount) + { + if (is_null($rangeCount)) { + throw new \InvalidArgumentException('non-nullable rangeCount cannot be null'); + } + $this->container['rangeCount'] = $rangeCount; + + return $this; + } + + /** + * Gets ranges + * + * @return int[]|null + */ + public function getRanges() + { + return $this->container['ranges']; + } + + /** + * Sets ranges + * + * @param int[]|null $ranges ranges + * + * @return self + */ + public function setRanges($ranges) + { + if (is_null($ranges)) { + throw new \InvalidArgumentException('non-nullable ranges cannot be null'); + } + $this->container['ranges'] = $ranges; + + return $this; + } + + /** + * Gets startedAt + * + * @return \DateTime|null + */ + public function getStartedAt() + { + return $this->container['startedAt']; + } + + /** + * Sets startedAt + * + * @param \DateTime|null $startedAt startedAt + * + * @return self + */ + public function setStartedAt($startedAt) + { + if (is_null($startedAt)) { + throw new \InvalidArgumentException('non-nullable startedAt cannot be null'); + } + $this->container['startedAt'] = $startedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/DatabaseExportStoreResponse.php b/api/src/Model/DatabaseExportStoreResponse.php new file mode 100644 index 0000000..b4ec9f8 --- /dev/null +++ b/api/src/Model/DatabaseExportStoreResponse.php @@ -0,0 +1,578 @@ + 'string', + 'databaseName' => 'string', + 'expiresAt' => '\DateTime', + 'id' => 'string', + 'rangeCount' => 'int', + 'ranges' => 'int[]', + 'startedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'databaseBranchName' => null, + 'databaseName' => null, + 'expiresAt' => 'date-time', + 'id' => null, + 'rangeCount' => null, + 'ranges' => null, + 'startedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'databaseBranchName' => false, + 'databaseName' => false, + 'expiresAt' => false, + 'id' => false, + 'rangeCount' => false, + 'ranges' => false, + 'startedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'databaseBranchName' => 'databaseBranchName', + 'databaseName' => 'databaseName', + 'expiresAt' => 'expiresAt', + 'id' => 'id', + 'rangeCount' => 'rangeCount', + 'ranges' => 'ranges', + 'startedAt' => 'startedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'databaseBranchName' => 'setDatabaseBranchName', + 'databaseName' => 'setDatabaseName', + 'expiresAt' => 'setExpiresAt', + 'id' => 'setId', + 'rangeCount' => 'setRangeCount', + 'ranges' => 'setRanges', + 'startedAt' => 'setStartedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'databaseBranchName' => 'getDatabaseBranchName', + 'databaseName' => 'getDatabaseName', + 'expiresAt' => 'getExpiresAt', + 'id' => 'getId', + 'rangeCount' => 'getRangeCount', + 'ranges' => 'getRanges', + 'startedAt' => 'getStartedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('databaseBranchName', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('expiresAt', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('rangeCount', $data ?? [], null); + $this->setIfExists('ranges', $data ?? [], null); + $this->setIfExists('startedAt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets databaseBranchName + * + * @return string|null + */ + public function getDatabaseBranchName() + { + return $this->container['databaseBranchName']; + } + + /** + * Sets databaseBranchName + * + * @param string|null $databaseBranchName databaseBranchName + * + * @return self + */ + public function setDatabaseBranchName($databaseBranchName) + { + if (is_null($databaseBranchName)) { + throw new \InvalidArgumentException('non-nullable databaseBranchName cannot be null'); + } + $this->container['databaseBranchName'] = $databaseBranchName; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets expiresAt + * + * @return \DateTime|null + */ + public function getExpiresAt() + { + return $this->container['expiresAt']; + } + + /** + * Sets expiresAt + * + * @param \DateTime|null $expiresAt expiresAt + * + * @return self + */ + public function setExpiresAt($expiresAt) + { + if (is_null($expiresAt)) { + throw new \InvalidArgumentException('non-nullable expiresAt cannot be null'); + } + $this->container['expiresAt'] = $expiresAt; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets rangeCount + * + * @return int|null + */ + public function getRangeCount() + { + return $this->container['rangeCount']; + } + + /** + * Sets rangeCount + * + * @param int|null $rangeCount rangeCount + * + * @return self + */ + public function setRangeCount($rangeCount) + { + if (is_null($rangeCount)) { + throw new \InvalidArgumentException('non-nullable rangeCount cannot be null'); + } + $this->container['rangeCount'] = $rangeCount; + + return $this; + } + + /** + * Gets ranges + * + * @return int[]|null + */ + public function getRanges() + { + return $this->container['ranges']; + } + + /** + * Sets ranges + * + * @param int[]|null $ranges ranges + * + * @return self + */ + public function setRanges($ranges) + { + if (is_null($ranges)) { + throw new \InvalidArgumentException('non-nullable ranges cannot be null'); + } + $this->container['ranges'] = $ranges; + + return $this; + } + + /** + * Gets startedAt + * + * @return \DateTime|null + */ + public function getStartedAt() + { + return $this->container['startedAt']; + } + + /** + * Sets startedAt + * + * @param \DateTime|null $startedAt startedAt + * + * @return self + */ + public function setStartedAt($startedAt) + { + if (is_null($startedAt)) { + throw new \InvalidArgumentException('non-nullable startedAt cannot be null'); + } + $this->container['startedAt'] = $startedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/GetImport200Response.php b/api/src/Model/GetImport200Response.php index 3db7a97..923f89f 100644 --- a/api/src/Model/GetImport200Response.php +++ b/api/src/Model/GetImport200Response.php @@ -22,7 +22,7 @@ class GetImport200Response implements ModelInterface, ArrayAccess, \JsonSerializ * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\ImportControllerShowResponse', + 'data' => '\Litebase\OpenAPI\Model\ImportShowResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\ImportControllerShowResponse + * @return \Litebase\OpenAPI\Model\ImportShowResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\ImportControllerShowResponse $data data + * @param \Litebase\OpenAPI\Model\ImportShowResponse $data data * * @return self */ diff --git a/api/src/Model/GetToken200Response.php b/api/src/Model/GetToken200Response.php index c651c00..53076a2 100644 --- a/api/src/Model/GetToken200Response.php +++ b/api/src/Model/GetToken200Response.php @@ -22,7 +22,7 @@ class GetToken200Response implements ModelInterface, ArrayAccess, \JsonSerializa * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\TokenControllerShowResponse', + 'data' => '\Litebase\OpenAPI\Model\TokenShowResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\TokenControllerShowResponse + * @return \Litebase\OpenAPI\Model\TokenShowResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\TokenControllerShowResponse $data data + * @param \Litebase\OpenAPI\Model\TokenShowResponse $data data * * @return self */ diff --git a/api/src/Model/GetUser200Response.php b/api/src/Model/GetUser200Response.php index e4bf5ea..6ad80d0 100644 --- a/api/src/Model/GetUser200Response.php +++ b/api/src/Model/GetUser200Response.php @@ -22,7 +22,7 @@ class GetUser200Response implements ModelInterface, ArrayAccess, \JsonSerializab * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\UserControllerShowResponse', + 'data' => '\Litebase\OpenAPI\Model\UserShowResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\UserControllerShowResponse + * @return \Litebase\OpenAPI\Model\UserShowResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\UserControllerShowResponse $data data + * @param \Litebase\OpenAPI\Model\UserShowResponse $data data * * @return self */ diff --git a/api/src/Model/ImportChunkStoreRequest.php b/api/src/Model/ImportChunkStoreRequest.php new file mode 100644 index 0000000..8c78f4a --- /dev/null +++ b/api/src/Model/ImportChunkStoreRequest.php @@ -0,0 +1,448 @@ + 'string', + 'chunkData' => 'string', + 'chunkIndex' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'checksum' => null, + 'chunkData' => null, + 'chunkIndex' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'checksum' => false, + 'chunkData' => false, + 'chunkIndex' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'checksum' => 'checksum', + 'chunkData' => 'chunkData', + 'chunkIndex' => 'chunkIndex' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'checksum' => 'setChecksum', + 'chunkData' => 'setChunkData', + 'chunkIndex' => 'setChunkIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'checksum' => 'getChecksum', + 'chunkData' => 'getChunkData', + 'chunkIndex' => 'getChunkIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('checksum', $data ?? [], null); + $this->setIfExists('chunkData', $data ?? [], null); + $this->setIfExists('chunkIndex', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['chunkData'] === null) { + $invalidProperties[] = "'chunkData' can't be null"; + } + if ($this->container['chunkIndex'] === null) { + $invalidProperties[] = "'chunkIndex' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets checksum + * + * @return string|null + */ + public function getChecksum() + { + return $this->container['checksum']; + } + + /** + * Sets checksum + * + * @param string|null $checksum checksum + * + * @return self + */ + public function setChecksum($checksum) + { + if (is_null($checksum)) { + throw new \InvalidArgumentException('non-nullable checksum cannot be null'); + } + $this->container['checksum'] = $checksum; + + return $this; + } + + /** + * Gets chunkData + * + * @return string + */ + public function getChunkData() + { + return $this->container['chunkData']; + } + + /** + * Sets chunkData + * + * @param string $chunkData chunkData + * + * @return self + */ + public function setChunkData($chunkData) + { + if (is_null($chunkData)) { + throw new \InvalidArgumentException('non-nullable chunkData cannot be null'); + } + $this->container['chunkData'] = $chunkData; + + return $this; + } + + /** + * Gets chunkIndex + * + * @return int + */ + public function getChunkIndex() + { + return $this->container['chunkIndex']; + } + + /** + * Sets chunkIndex + * + * @param int $chunkIndex chunkIndex + * + * @return self + */ + public function setChunkIndex($chunkIndex) + { + if (is_null($chunkIndex)) { + throw new \InvalidArgumentException('non-nullable chunkIndex cannot be null'); + } + $this->container['chunkIndex'] = $chunkIndex; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportChunkStoreResponse.php b/api/src/Model/ImportChunkStoreResponse.php new file mode 100644 index 0000000..d78c578 --- /dev/null +++ b/api/src/Model/ImportChunkStoreResponse.php @@ -0,0 +1,442 @@ + 'int', + 'importId' => 'int', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'chunkIndex' => null, + 'importId' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'chunkIndex' => false, + 'importId' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'chunkIndex' => 'chunkIndex', + 'importId' => 'importId', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'chunkIndex' => 'setChunkIndex', + 'importId' => 'setImportId', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'chunkIndex' => 'getChunkIndex', + 'importId' => 'getImportId', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('chunkIndex', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets chunkIndex + * + * @return int|null + */ + public function getChunkIndex() + { + return $this->container['chunkIndex']; + } + + /** + * Sets chunkIndex + * + * @param int|null $chunkIndex chunkIndex + * + * @return self + */ + public function setChunkIndex($chunkIndex) + { + if (is_null($chunkIndex)) { + throw new \InvalidArgumentException('non-nullable chunkIndex cannot be null'); + } + $this->container['chunkIndex'] = $chunkIndex; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportShowResponse.php b/api/src/Model/ImportShowResponse.php new file mode 100644 index 0000000..778c66e --- /dev/null +++ b/api/src/Model/ImportShowResponse.php @@ -0,0 +1,748 @@ + 'string', + 'chunkCount' => 'int', + 'completedAt' => '\DateTime', + 'createdAt' => '\DateTime', + 'databaseId' => 'string', + 'databaseName' => 'string', + 'importId' => 'int', + 'missingChunks' => 'int[]', + 'status' => 'string', + 'totalSize' => 'int', + 'updatedAt' => '\DateTime', + 'uploadedChunks' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'completedAt' => 'date-time', + 'createdAt' => 'date-time', + 'databaseId' => null, + 'databaseName' => null, + 'importId' => null, + 'missingChunks' => null, + 'status' => null, + 'totalSize' => null, + 'updatedAt' => 'date-time', + 'uploadedChunks' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'completedAt' => false, + 'createdAt' => false, + 'databaseId' => false, + 'databaseName' => false, + 'importId' => false, + 'missingChunks' => false, + 'status' => false, + 'totalSize' => false, + 'updatedAt' => false, + 'uploadedChunks' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'completedAt' => 'completedAt', + 'createdAt' => 'createdAt', + 'databaseId' => 'databaseId', + 'databaseName' => 'databaseName', + 'importId' => 'importId', + 'missingChunks' => 'missingChunks', + 'status' => 'status', + 'totalSize' => 'totalSize', + 'updatedAt' => 'updatedAt', + 'uploadedChunks' => 'uploadedChunks' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'completedAt' => 'setCompletedAt', + 'createdAt' => 'setCreatedAt', + 'databaseId' => 'setDatabaseId', + 'databaseName' => 'setDatabaseName', + 'importId' => 'setImportId', + 'missingChunks' => 'setMissingChunks', + 'status' => 'setStatus', + 'totalSize' => 'setTotalSize', + 'updatedAt' => 'setUpdatedAt', + 'uploadedChunks' => 'setUploadedChunks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'completedAt' => 'getCompletedAt', + 'createdAt' => 'getCreatedAt', + 'databaseId' => 'getDatabaseId', + 'databaseName' => 'getDatabaseName', + 'importId' => 'getImportId', + 'missingChunks' => 'getMissingChunks', + 'status' => 'getStatus', + 'totalSize' => 'getTotalSize', + 'updatedAt' => 'getUpdatedAt', + 'uploadedChunks' => 'getUploadedChunks' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('completedAt', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('databaseId', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('missingChunks', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('totalSize', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('uploadedChunks', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int|null + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int|null $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets completedAt + * + * @return \DateTime|null + */ + public function getCompletedAt() + { + return $this->container['completedAt']; + } + + /** + * Sets completedAt + * + * @param \DateTime|null $completedAt completedAt + * + * @return self + */ + public function setCompletedAt($completedAt) + { + if (is_null($completedAt)) { + throw new \InvalidArgumentException('non-nullable completedAt cannot be null'); + } + $this->container['completedAt'] = $completedAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Creation timestamp + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets databaseId + * + * @return string|null + */ + public function getDatabaseId() + { + return $this->container['databaseId']; + } + + /** + * Sets databaseId + * + * @param string|null $databaseId databaseId + * + * @return self + */ + public function setDatabaseId($databaseId) + { + if (is_null($databaseId)) { + throw new \InvalidArgumentException('non-nullable databaseId cannot be null'); + } + $this->container['databaseId'] = $databaseId; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets missingChunks + * + * @return int[]|null + */ + public function getMissingChunks() + { + return $this->container['missingChunks']; + } + + /** + * Sets missingChunks + * + * @param int[]|null $missingChunks missingChunks + * + * @return self + */ + public function setMissingChunks($missingChunks) + { + if (is_null($missingChunks)) { + throw new \InvalidArgumentException('non-nullable missingChunks cannot be null'); + } + $this->container['missingChunks'] = $missingChunks; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets totalSize + * + * @return int|null + */ + public function getTotalSize() + { + return $this->container['totalSize']; + } + + /** + * Sets totalSize + * + * @param int|null $totalSize totalSize + * + * @return self + */ + public function setTotalSize($totalSize) + { + if (is_null($totalSize)) { + throw new \InvalidArgumentException('non-nullable totalSize cannot be null'); + } + $this->container['totalSize'] = $totalSize; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Last update timestamp + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets uploadedChunks + * + * @return int|null + */ + public function getUploadedChunks() + { + return $this->container['uploadedChunks']; + } + + /** + * Sets uploadedChunks + * + * @param int|null $uploadedChunks uploadedChunks + * + * @return self + */ + public function setUploadedChunks($uploadedChunks) + { + if (is_null($uploadedChunks)) { + throw new \InvalidArgumentException('non-nullable uploadedChunks cannot be null'); + } + $this->container['uploadedChunks'] = $uploadedChunks; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportStoreRequest.php b/api/src/Model/ImportStoreRequest.php new file mode 100644 index 0000000..b3ab8bc --- /dev/null +++ b/api/src/Model/ImportStoreRequest.php @@ -0,0 +1,448 @@ + 'string', + 'chunkCount' => 'int', + 'databaseName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'databaseName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'databaseName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'databaseName' => 'databaseName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'databaseName' => 'setDatabaseName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'databaseName' => 'getDatabaseName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['chunkCount'] === null) { + $invalidProperties[] = "'chunkCount' can't be null"; + } + if ($this->container['databaseName'] === null) { + $invalidProperties[] = "'databaseName' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets databaseName + * + * @return string + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportStoreResponse.php b/api/src/Model/ImportStoreResponse.php new file mode 100644 index 0000000..01eaf81 --- /dev/null +++ b/api/src/Model/ImportStoreResponse.php @@ -0,0 +1,578 @@ + 'string', + 'chunkCount' => 'int', + 'createdAt' => '\DateTime', + 'databaseId' => 'string', + 'databaseName' => 'string', + 'importId' => 'int', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'createdAt' => 'date-time', + 'databaseId' => null, + 'databaseName' => null, + 'importId' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'createdAt' => false, + 'databaseId' => false, + 'databaseName' => false, + 'importId' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'createdAt' => 'createdAt', + 'databaseId' => 'databaseId', + 'databaseName' => 'databaseName', + 'importId' => 'importId', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'createdAt' => 'setCreatedAt', + 'databaseId' => 'setDatabaseId', + 'databaseName' => 'setDatabaseName', + 'importId' => 'setImportId', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'createdAt' => 'getCreatedAt', + 'databaseId' => 'getDatabaseId', + 'databaseName' => 'getDatabaseName', + 'importId' => 'getImportId', + 'status' => 'getStatus' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('databaseId', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int|null + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int|null $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets createdAt + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param \DateTime|null $createdAt Creation timestamp + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets databaseId + * + * @return string|null + */ + public function getDatabaseId() + { + return $this->container['databaseId']; + } + + /** + * Sets databaseId + * + * @param string|null $databaseId databaseId + * + * @return self + */ + public function setDatabaseId($databaseId) + { + if (is_null($databaseId)) { + throw new \InvalidArgumentException('non-nullable databaseId cannot be null'); + } + $this->container['databaseId'] = $databaseId; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportUpdateRequest.php b/api/src/Model/ImportUpdateRequest.php new file mode 100644 index 0000000..481b523 --- /dev/null +++ b/api/src/Model/ImportUpdateRequest.php @@ -0,0 +1,448 @@ + 'string', + 'chunkCount' => 'int', + 'databaseName' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'databaseName' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'databaseName' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'databaseName' => 'databaseName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'databaseName' => 'setDatabaseName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'databaseName' => 'getDatabaseName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['chunkCount'] === null) { + $invalidProperties[] = "'chunkCount' can't be null"; + } + if ($this->container['databaseName'] === null) { + $invalidProperties[] = "'databaseName' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets databaseName + * + * @return string + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/ImportUpdateResponse.php b/api/src/Model/ImportUpdateResponse.php new file mode 100644 index 0000000..034934c --- /dev/null +++ b/api/src/Model/ImportUpdateResponse.php @@ -0,0 +1,578 @@ + 'string', + 'chunkCount' => 'int', + 'databaseId' => 'string', + 'databaseName' => 'string', + 'importId' => 'int', + 'status' => 'string', + 'updatedAt' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'branchName' => null, + 'chunkCount' => null, + 'databaseId' => null, + 'databaseName' => null, + 'importId' => null, + 'status' => null, + 'updatedAt' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'branchName' => false, + 'chunkCount' => false, + 'databaseId' => false, + 'databaseName' => false, + 'importId' => false, + 'status' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'branchName' => 'branchName', + 'chunkCount' => 'chunkCount', + 'databaseId' => 'databaseId', + 'databaseName' => 'databaseName', + 'importId' => 'importId', + 'status' => 'status', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'branchName' => 'setBranchName', + 'chunkCount' => 'setChunkCount', + 'databaseId' => 'setDatabaseId', + 'databaseName' => 'setDatabaseName', + 'importId' => 'setImportId', + 'status' => 'setStatus', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'branchName' => 'getBranchName', + 'chunkCount' => 'getChunkCount', + 'databaseId' => 'getDatabaseId', + 'databaseName' => 'getDatabaseName', + 'importId' => 'getImportId', + 'status' => 'getStatus', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('branchName', $data ?? [], null); + $this->setIfExists('chunkCount', $data ?? [], null); + $this->setIfExists('databaseId', $data ?? [], null); + $this->setIfExists('databaseName', $data ?? [], null); + $this->setIfExists('importId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets branchName + * + * @return string|null + */ + public function getBranchName() + { + return $this->container['branchName']; + } + + /** + * Sets branchName + * + * @param string|null $branchName branchName + * + * @return self + */ + public function setBranchName($branchName) + { + if (is_null($branchName)) { + throw new \InvalidArgumentException('non-nullable branchName cannot be null'); + } + $this->container['branchName'] = $branchName; + + return $this; + } + + /** + * Gets chunkCount + * + * @return int|null + */ + public function getChunkCount() + { + return $this->container['chunkCount']; + } + + /** + * Sets chunkCount + * + * @param int|null $chunkCount chunkCount + * + * @return self + */ + public function setChunkCount($chunkCount) + { + if (is_null($chunkCount)) { + throw new \InvalidArgumentException('non-nullable chunkCount cannot be null'); + } + $this->container['chunkCount'] = $chunkCount; + + return $this; + } + + /** + * Gets databaseId + * + * @return string|null + */ + public function getDatabaseId() + { + return $this->container['databaseId']; + } + + /** + * Sets databaseId + * + * @param string|null $databaseId databaseId + * + * @return self + */ + public function setDatabaseId($databaseId) + { + if (is_null($databaseId)) { + throw new \InvalidArgumentException('non-nullable databaseId cannot be null'); + } + $this->container['databaseId'] = $databaseId; + + return $this; + } + + /** + * Gets databaseName + * + * @return string|null + */ + public function getDatabaseName() + { + return $this->container['databaseName']; + } + + /** + * Sets databaseName + * + * @param string|null $databaseName databaseName + * + * @return self + */ + public function setDatabaseName($databaseName) + { + if (is_null($databaseName)) { + throw new \InvalidArgumentException('non-nullable databaseName cannot be null'); + } + $this->container['databaseName'] = $databaseName; + + return $this; + } + + /** + * Gets importId + * + * @return int|null + */ + public function getImportId() + { + return $this->container['importId']; + } + + /** + * Sets importId + * + * @param int|null $importId importId + * + * @return self + */ + public function setImportId($importId) + { + if (is_null($importId)) { + throw new \InvalidArgumentException('non-nullable importId cannot be null'); + } + $this->container['importId'] = $importId; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets updatedAt + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param \DateTime|null $updatedAt Last update timestamp + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/TokenShowResponse.php b/api/src/Model/TokenShowResponse.php new file mode 100644 index 0000000..bcdc52d --- /dev/null +++ b/api/src/Model/TokenShowResponse.php @@ -0,0 +1,510 @@ + 'string', + 'description' => 'string', + 'statements' => '\Litebase\OpenAPI\Model\Statement[]', + 'tokenId' => 'string', + 'updatedAt' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => null, + 'description' => null, + 'statements' => null, + 'tokenId' => null, + 'updatedAt' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'createdAt' => false, + 'description' => false, + 'statements' => false, + 'tokenId' => false, + 'updatedAt' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'createdAt' => 'createdAt', + 'description' => 'description', + 'statements' => 'statements', + 'tokenId' => 'tokenId', + 'updatedAt' => 'updatedAt' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + 'description' => 'setDescription', + 'statements' => 'setStatements', + 'tokenId' => 'setTokenId', + 'updatedAt' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + 'description' => 'getDescription', + 'statements' => 'getStatements', + 'tokenId' => 'getTokenId', + 'updatedAt' => 'getUpdatedAt' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('statements', $data ?? [], null); + $this->setIfExists('tokenId', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets statements + * + * @return \Litebase\OpenAPI\Model\Statement[]|null + */ + public function getStatements() + { + return $this->container['statements']; + } + + /** + * Sets statements + * + * @param \Litebase\OpenAPI\Model\Statement[]|null $statements statements + * + * @return self + */ + public function setStatements($statements) + { + if (is_null($statements)) { + throw new \InvalidArgumentException('non-nullable statements cannot be null'); + } + $this->container['statements'] = $statements; + + return $this; + } + + /** + * Gets tokenId + * + * @return string|null + */ + public function getTokenId() + { + return $this->container['tokenId']; + } + + /** + * Sets tokenId + * + * @param string|null $tokenId tokenId + * + * @return self + */ + public function setTokenId($tokenId) + { + if (is_null($tokenId)) { + throw new \InvalidArgumentException('non-nullable tokenId cannot be null'); + } + $this->container['tokenId'] = $tokenId; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/UpdateImport200Response.php b/api/src/Model/UpdateImport200Response.php index 8476f49..fc213ed 100644 --- a/api/src/Model/UpdateImport200Response.php +++ b/api/src/Model/UpdateImport200Response.php @@ -22,6 +22,7 @@ class UpdateImport200Response implements ModelInterface, ArrayAccess, \JsonSeria * @var string[] */ protected static $openAPITypes = [ + 'data' => '\Litebase\OpenAPI\Model\ImportUpdateResponse', 'message' => 'string', 'status' => 'string' ]; @@ -34,6 +35,7 @@ class UpdateImport200Response implements ModelInterface, ArrayAccess, \JsonSeria * @psalm-var array */ protected static $openAPIFormats = [ + 'data' => null, 'message' => null, 'status' => null ]; @@ -44,6 +46,7 @@ class UpdateImport200Response implements ModelInterface, ArrayAccess, \JsonSeria * @var boolean[] */ protected static array $openAPINullables = [ + 'data' => false, 'message' => false, 'status' => false ]; @@ -134,6 +137,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'data' => 'data', 'message' => 'message', 'status' => 'status' ]; @@ -144,6 +148,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'data' => 'setData', 'message' => 'setMessage', 'status' => 'setStatus' ]; @@ -154,6 +159,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'data' => 'getData', 'message' => 'getMessage', 'status' => 'getStatus' ]; @@ -215,6 +221,7 @@ public function getModelName() */ public function __construct(?array $data = null) { + $this->setIfExists('data', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); } @@ -246,6 +253,9 @@ public function listInvalidProperties() { $invalidProperties = []; + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } if ($this->container['message'] === null) { $invalidProperties[] = "'message' can't be null"; } @@ -267,6 +277,33 @@ public function valid() } + /** + * Gets data + * + * @return \Litebase\OpenAPI\Model\ImportUpdateResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportUpdateResponse $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** * Gets message * diff --git a/api/src/Model/UpdateUser200Response.php b/api/src/Model/UpdateUser200Response.php index b56febd..8c7974e 100644 --- a/api/src/Model/UpdateUser200Response.php +++ b/api/src/Model/UpdateUser200Response.php @@ -22,7 +22,7 @@ class UpdateUser200Response implements ModelInterface, ArrayAccess, \JsonSeriali * @var string[] */ protected static $openAPITypes = [ - 'data' => '\Litebase\OpenAPI\Model\UserControllerUpdateResponse', + 'data' => '\Litebase\OpenAPI\Model\UserUpdateResponse', 'message' => 'string', 'status' => 'string' ]; @@ -280,7 +280,7 @@ public function valid() /** * Gets data * - * @return \Litebase\OpenAPI\Model\UserControllerUpdateResponse + * @return \Litebase\OpenAPI\Model\UserUpdateResponse */ public function getData() { @@ -290,7 +290,7 @@ public function getData() /** * Sets data * - * @param \Litebase\OpenAPI\Model\UserControllerUpdateResponse $data data + * @param \Litebase\OpenAPI\Model\UserUpdateResponse $data data * * @return self */ diff --git a/api/src/Model/UserShowResponse.php b/api/src/Model/UserShowResponse.php new file mode 100644 index 0000000..833e2d3 --- /dev/null +++ b/api/src/Model/UserShowResponse.php @@ -0,0 +1,510 @@ + 'string', + 'description' => 'string', + 'statements' => '\Litebase\OpenAPI\Model\Statement[]', + 'updatedAt' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => null, + 'description' => null, + 'statements' => null, + 'updatedAt' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'createdAt' => false, + 'description' => false, + 'statements' => false, + 'updatedAt' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'createdAt' => 'createdAt', + 'description' => 'description', + 'statements' => 'statements', + 'updatedAt' => 'updatedAt', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + 'description' => 'setDescription', + 'statements' => 'setStatements', + 'updatedAt' => 'setUpdatedAt', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + 'description' => 'getDescription', + 'statements' => 'getStatements', + 'updatedAt' => 'getUpdatedAt', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('statements', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets statements + * + * @return \Litebase\OpenAPI\Model\Statement[]|null + */ + public function getStatements() + { + return $this->container['statements']; + } + + /** + * Sets statements + * + * @param \Litebase\OpenAPI\Model\Statement[]|null $statements statements + * + * @return self + */ + public function setStatements($statements) + { + if (is_null($statements)) { + throw new \InvalidArgumentException('non-nullable statements cannot be null'); + } + $this->container['statements'] = $statements; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/UserStoreResponse.php b/api/src/Model/UserStoreResponse.php new file mode 100644 index 0000000..c47697c --- /dev/null +++ b/api/src/Model/UserStoreResponse.php @@ -0,0 +1,510 @@ + 'string', + 'description' => 'string', + 'statements' => '\Litebase\OpenAPI\Model\Statement[]', + 'updatedAt' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => null, + 'description' => null, + 'statements' => null, + 'updatedAt' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'createdAt' => false, + 'description' => false, + 'statements' => false, + 'updatedAt' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'createdAt' => 'createdAt', + 'description' => 'description', + 'statements' => 'statements', + 'updatedAt' => 'updatedAt', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + 'description' => 'setDescription', + 'statements' => 'setStatements', + 'updatedAt' => 'setUpdatedAt', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + 'description' => 'getDescription', + 'statements' => 'getStatements', + 'updatedAt' => 'getUpdatedAt', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('statements', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets statements + * + * @return \Litebase\OpenAPI\Model\Statement[]|null + */ + public function getStatements() + { + return $this->container['statements']; + } + + /** + * Sets statements + * + * @param \Litebase\OpenAPI\Model\Statement[]|null $statements statements + * + * @return self + */ + public function setStatements($statements) + { + if (is_null($statements)) { + throw new \InvalidArgumentException('non-nullable statements cannot be null'); + } + $this->container['statements'] = $statements; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/api/src/Model/UserUpdateResponse.php b/api/src/Model/UserUpdateResponse.php new file mode 100644 index 0000000..426aeaf --- /dev/null +++ b/api/src/Model/UserUpdateResponse.php @@ -0,0 +1,510 @@ + 'string', + 'description' => 'string', + 'statements' => '\Litebase\OpenAPI\Model\Statement[]', + 'updatedAt' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => null, + 'description' => null, + 'statements' => null, + 'updatedAt' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'createdAt' => false, + 'description' => false, + 'statements' => false, + 'updatedAt' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'createdAt' => 'createdAt', + 'description' => 'description', + 'statements' => 'statements', + 'updatedAt' => 'updatedAt', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + 'description' => 'setDescription', + 'statements' => 'setStatements', + 'updatedAt' => 'setUpdatedAt', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + 'description' => 'getDescription', + 'statements' => 'getStatements', + 'updatedAt' => 'getUpdatedAt', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[]|null $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('createdAt', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('statements', $data ?? [], null); + $this->setIfExists('updatedAt', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + if (is_null($createdAt)) { + throw new \InvalidArgumentException('non-nullable createdAt cannot be null'); + } + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets statements + * + * @return \Litebase\OpenAPI\Model\Statement[]|null + */ + public function getStatements() + { + return $this->container['statements']; + } + + /** + * Sets statements + * + * @param \Litebase\OpenAPI\Model\Statement[]|null $statements statements + * + * @return self + */ + public function setStatements($statements) + { + if (is_null($statements)) { + throw new \InvalidArgumentException('non-nullable statements cannot be null'); + } + $this->container['statements'] = $statements; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt updatedAt + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + if (is_null($updatedAt)) { + throw new \InvalidArgumentException('non-nullable updatedAt cannot be null'); + } + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/ApiClient.php b/src/ApiClient.php index 00b32b6..e2fdacc 100644 --- a/src/ApiClient.php +++ b/src/ApiClient.php @@ -13,6 +13,7 @@ use Litebase\OpenAPI\API\DatabaseBackupApi; use Litebase\OpenAPI\API\DatabaseBranchApi; use Litebase\OpenAPI\API\DatabaseExportApi; +use Litebase\OpenAPI\API\DatabaseExportEndApi; use Litebase\OpenAPI\API\DatabaseExportPartApi; use Litebase\OpenAPI\API\DatabaseRestoreApi; use Litebase\OpenAPI\API\DatabaseSnapshotApi; @@ -111,6 +112,11 @@ public function databaseExport(): DatabaseExportApi return new DatabaseExportApi($this->getHttpClient(), $this->config); } + public function databaseExportEnd(): DatabaseExportEndApi + { + return new DatabaseExportEndApi($this->getHttpClient(), $this->config); + } + public function databaseExportPart(): DatabaseExportPartApi { return new DatabaseExportPartApi($this->getHttpClient(), $this->config); From 80b57a31079014bdbedadf6040a6dff72ab8e187 Mon Sep 17 00:00:00 2001 From: Thiery Laverdure Date: Tue, 6 Jan 2026 11:25:56 -0500 Subject: [PATCH 4/4] Update test runner --- tests/Integration/ApiClientTestRunner.php | 13 +++++++------ tests/Integration/LitebaseContainer.php | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/Integration/ApiClientTestRunner.php b/tests/Integration/ApiClientTestRunner.php index 115bcdf..a389644 100644 --- a/tests/Integration/ApiClientTestRunner.php +++ b/tests/Integration/ApiClientTestRunner.php @@ -250,13 +250,13 @@ protected function captureResponseData(array $captured, ResponseData $responseSp $method = "get$pascalCasePart"; if (! is_object($currentObject) || ! method_exists($currentObject, $method)) { - throw new \Exception("Method {$method} does not exist on ".(is_object($currentObject) ? get_class($currentObject) : gettype($currentObject))); + throw new \Exception("Method {$method} does not exist on " . (is_object($currentObject) ? get_class($currentObject) : gettype($currentObject))); } $array = $currentObject->{$method}(); if (! is_array($array)) { - throw new \Exception("Expected array from {$method}(), got ".gettype($array)); + throw new \Exception("Expected array from {$method}(), got " . gettype($array)); } if (! isset($array[$index])) { @@ -284,13 +284,13 @@ protected function captureResponseData(array $captured, ResponseData $responseSp $snakeCaseKey = strtolower((string) preg_replace('/(?{$snakeCaseKey} ?? $currentObject->{$segment}; } } else { - throw new \Exception("Cannot access property '{$segment}' on ".gettype($currentObject)); + throw new \Exception("Cannot access property '{$segment}' on " . gettype($currentObject)); } } } @@ -322,6 +322,7 @@ protected function getRequestObject(RequestData $request, array $captured): mixe array_walk_recursive($body, function (&$value) use ($captured) { if (is_string($value) && preg_match('/^\{\{(.+?)\}\}$/', $value, $matches)) { $key = $matches[1]; + if (array_key_exists($key, $captured)) { $value = $captured[$key]; } else { @@ -422,7 +423,7 @@ protected function prepareRequestParameters(RequestData $request, $captured): ar if (array_key_exists($key, $captured)) { $params[] = $captured[$key]; } else { - throw new \Exception("Captured parameter '".$key."' not found for operation '{$request->operation}'"); + throw new \Exception("Captured parameter '" . $key . "' not found for operation '{$request->operation}'"); } } } @@ -505,7 +506,7 @@ public function runSteps(array $steps): void $api, $operationId, $responseSpec, - $this->prepareRequestArguments($request, $params, $requestObject) + $this->prepareRequestArguments($request, $params, $requestObject ?? "") ); if ($responseSpec === null) { diff --git a/tests/Integration/LitebaseContainer.php b/tests/Integration/LitebaseContainer.php index 0589bca..449e208 100644 --- a/tests/Integration/LitebaseContainer.php +++ b/tests/Integration/LitebaseContainer.php @@ -13,16 +13,16 @@ public static function start(): void $startCommand = 'docker run -d --rm --name litebase-test -p 8888:8888 \\ -e LITEBASE_CLUSTER_ID=cluster-1 \\ - -e LITEBASE_DATA_PATH=/tmp/data \\ -e LITEBASE_ENCRYPTION_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\ -e LITEBASE_ENV=testing \\ -e LITEBASE_PORT=8888 \\ -e LITEBASE_ROOT_USERNAME=root \\ -e LITEBASE_ROOT_PASSWORD=password \\ + -e LITEBASE_STORAGE_LOCAL_PATH=/tmp/data \\ -e LITEBASE_STORAGE_NETWORK_PATH=/tmp/data/_network \\ -e LITEBASE_STORAGE_TMP_PATH=/tmp \\ -e LITEBASE_STORAGE_OBJECT_MODE=local \\ - litebase/litebase start'; + litebase/litebase:latest start'; shell_exec($startCommand);