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..6b8c74b --- /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 \Litebase\OpenAPI\Model\CreateDatabaseExport200Response|\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 \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]) + { + $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( + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', + $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( + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response', + $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 = '\Litebase\OpenAPI\Model\CreateDatabaseExport200Response'; + $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/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 new file mode 100644 index 0000000..664256a --- /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/octet-stream', '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..7349830 --- /dev/null +++ b/api/src/API/ImportApi.php @@ -0,0 +1,1505 @@ + [ + '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\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($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + list($response) = $this->createImportWithHttpInfo($importStoreRequest, $contentType); + return $response; + } + + /** + * Operation createImportWithHttpInfo + * + * Create a new import + * + * @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($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + $request = $this->createImportRequest($importStoreRequest, $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\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($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + return $this->createImportAsyncWithHttpInfo($importStoreRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createImportAsyncWithHttpInfo + * + * Create a new import + * + * @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($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\CreateImport201Response'; + $request = $this->createImportRequest($importStoreRequest, $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\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($importStoreRequest, string $contentType = self::contentTypes['createImport'][0]) + { + + // verify the required parameter 'importStoreRequest' is set + if ($importStoreRequest === null || (is_array($importStoreRequest) && count($importStoreRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importStoreRequest 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($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($importStoreRequest)); + } else { + $httpBody = $importStoreRequest; + } + } 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 \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, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) + { + list($response) = $this->updateImportWithHttpInfo($importId, $importUpdateRequest, $contentType); + return $response; + } + + /** + * Operation updateImportWithHttpInfo + * + * 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, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) + { + $request = $this->updateImportRequest($importId, $importUpdateRequest, $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 \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, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) + { + return $this->updateImportAsyncWithHttpInfo($importId, $importUpdateRequest, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateImportAsyncWithHttpInfo + * + * 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, $importUpdateRequest, string $contentType = self::contentTypes['updateImport'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\UpdateImport200Response'; + $request = $this->updateImportRequest($importId, $importUpdateRequest, $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 \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, $importUpdateRequest, 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' + ); + } + + // 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 = []; + $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($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) { + $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..768a9d2 --- /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\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, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + list($response) = $this->createImportChunkWithHttpInfo($importId, $importChunkStoreRequest, $contentType); + return $response; + } + + /** + * Operation createImportChunkWithHttpInfo + * + * Create a new import chunk + * + * @param string $importId The importId parameter (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, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + $request = $this->createImportChunkRequest($importId, $importChunkStoreRequest, $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\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, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + return $this->createImportChunkAsyncWithHttpInfo($importId, $importChunkStoreRequest, $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\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, $importChunkStoreRequest, string $contentType = self::contentTypes['createImportChunk'][0]) + { + $returnType = '\Litebase\OpenAPI\Model\CreateImportChunk201Response'; + $request = $this->createImportChunkRequest($importId, $importChunkStoreRequest, $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\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, $importChunkStoreRequest, 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 'importChunkStoreRequest' is set + if ($importChunkStoreRequest === null || (is_array($importChunkStoreRequest) && count($importChunkStoreRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $importChunkStoreRequest 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($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($importChunkStoreRequest)); + } else { + $httpBody = $importChunkStoreRequest; + } + } 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/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 new file mode 100644 index 0000000..ad377cf --- /dev/null +++ b/api/src/Model/CreateImport201Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportStoreResponse', + '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\ImportStoreResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportStoreResponse $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..cd733ca --- /dev/null +++ b/api/src/Model/CreateImportChunk201Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportChunkStoreResponse', + '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\ImportChunkStoreResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportChunkStoreResponse $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/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/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..923f89f --- /dev/null +++ b/api/src/Model/GetImport200Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportShowResponse', + '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\ImportShowResponse + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Litebase\OpenAPI\Model\ImportShowResponse $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/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/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/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/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/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/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/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 new file mode 100644 index 0000000..fc213ed --- /dev/null +++ b/api/src/Model/UpdateImport200Response.php @@ -0,0 +1,451 @@ + '\Litebase\OpenAPI\Model\ImportUpdateResponse', + '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\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 + * + * @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/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 d43b06c..e2fdacc 100644 --- a/src/ApiClient.php +++ b/src/ApiClient.php @@ -12,8 +12,13 @@ use Litebase\OpenAPI\API\DatabaseApi; 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; +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 +107,21 @@ public function databaseBranch(): DatabaseBranchApi return new DatabaseBranchApi($this->getHttpClient(), $this->config); } + 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); + } + public function databaseRestore(): DatabaseRestoreApi { return new DatabaseRestoreApi($this->getHttpClient(), $this->config); @@ -112,6 +132,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); 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);