diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index d14475a3..587e3bc6 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -107,50 +107,8 @@ Service/StrictJsonDeserializationVisitorFactory.php Service/SymfonyValidator.php Service/TypeMismatchException.php Service/ValidatorInterface.php -Tests/Api/AuthenticationApiInterfaceTest.php -Tests/Api/MediaLibraryApiInterfaceTest.php -Tests/Api/NotificationsApiInterfaceTest.php -Tests/Api/ProjectsApiInterfaceTest.php -Tests/Api/SearchApiInterfaceTest.php -Tests/Api/UserApiInterfaceTest.php -Tests/Api/UtilityApiInterfaceTest.php Tests/AppKernel.php Tests/Controller/ControllerTest.php -Tests/Model/BaseUserTest.php -Tests/Model/BasicUserDataResponseTest.php -Tests/Model/DryRunTest.php -Tests/Model/ExtendedUserDataResponseAllOfTest.php -Tests/Model/ExtendedUserDataResponseTest.php -Tests/Model/ExtensionResponseTest.php -Tests/Model/FeaturedProjectResponseTest.php -Tests/Model/JWTResponseTest.php -Tests/Model/LoginRequestTest.php -Tests/Model/MediaCategoryResponseTest.php -Tests/Model/MediaFileResponseTest.php -Tests/Model/MediaPackageResponseTest.php -Tests/Model/NotificationContentTest.php -Tests/Model/NotificationResponseTest.php -Tests/Model/NotificationsCountResponseTest.php -Tests/Model/OAuthLoginRequestTest.php -Tests/Model/ProjectReportRequestTest.php -Tests/Model/ProjectResponseTest.php -Tests/Model/ProjectsCategoryTest.php -Tests/Model/RefreshRequestTest.php -Tests/Model/RegisterErrorResponseTest.php -Tests/Model/RegisterRequestTest.php -Tests/Model/ResetPasswordErrorResponseTest.php -Tests/Model/ResetPasswordRequestTest.php -Tests/Model/SearchResponseTest.php -Tests/Model/SurveyResponseTest.php -Tests/Model/TagResponseTest.php -Tests/Model/UpdateProjectErrorResponseTest.php -Tests/Model/UpdateProjectFailureResponseTest.php -Tests/Model/UpdateProjectRequestTest.php -Tests/Model/UpdateUserErrorResponseTest.php -Tests/Model/UpdateUserRequestAllOfTest.php -Tests/Model/UpdateUserRequestTest.php -Tests/Model/UpgradeTokenRequestTest.php -Tests/Model/UploadErrorResponseTest.php Tests/test_config.yml autoload.php git_push.sh diff --git a/Api/ApiServer.php b/Api/ApiServer.php index 742727f1..05049f16 100644 --- a/Api/ApiServer.php +++ b/Api/ApiServer.php @@ -1,24 +1,24 @@ apis[$api])) { - throw new \InvalidArgumentException('API has already a handler: '.$api); - } + /** + * @var array + */ + private array $apis = array(); - $this->apis[$api] = $handler; - } + /** + * Adds an API handler to the server. + * + * @param string $api An API name of the handle + * @param mixed $handler A handler to set for the given API + */ + public function addApiHandler(string $api, $handler): void + { + if (isset($this->apis[$api])) { + throw new \InvalidArgumentException('API has already a handler: '.$api); + } - /** - * Returns an API handler. - * - * @param string $api An API name of the handle - * - * @throws \InvalidArgumentException When no such handler exists - * - * @return mixed Returns a handler - */ - public function getApiHandler(string $api) - { - if (!isset($this->apis[$api])) { - throw new \InvalidArgumentException('No handler for '.$api.' implemented.'); + $this->apis[$api] = $handler; } - return $this->apis[$api]; - } + /** + * Returns an API handler. + * + * @param string $api An API name of the handle + * @return mixed Returns a handler + * @throws \InvalidArgumentException When no such handler exists + */ + public function getApiHandler(string $api) + { + if (!isset($this->apis[$api])) { + throw new \InvalidArgumentException('No handler for '.$api.' implemented.'); + } + + return $this->apis[$api]; + } } diff --git a/Api/AuthenticationApiInterface.php b/Api/AuthenticationApiInterface.php index 541d691f..3d651c0d 100644 --- a/Api/AuthenticationApiInterface.php +++ b/Api/AuthenticationApiInterface.php @@ -1,24 +1,24 @@ headers->get('authorization'); - - // Read out all input parameter values into variables - $x_refresh = $request->headers->get('X-Refresh'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $x_refresh = $this->deserialize($x_refresh, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($x_refresh, $asserts); - if ($response instanceof Response) { - return $response; - } - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; - - $handler->authenticationDelete($x_refresh, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation authenticationDelete + * + * Expires refresh token + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationDeleteAction(Request $request) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $x_refresh = $request->headers->get('X-Refresh'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $x_refresh = $this->deserialize($x_refresh, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($x_refresh, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; + + $handler->authenticationDelete($x_refresh, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -119,60 +124,60 @@ public function authenticationDeleteAction(Request $request) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - } - /** - * Operation authenticationGet. - * - * Check token - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function authenticationGetAction(Request $request) - { - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); + /** + * Operation authenticationGet + * + * Check token + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationGetAction(Request $request) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); - // Read out all input parameter values into variables + // Read out all input parameter values into variables - // Use the default value if no value was provided + // Use the default value if no value was provided - // Validate the input values + // Validate the input values - try { - $handler = $this->getApiHandler(); - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); + try { + $handler = $this->getApiHandler(); - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); - $handler->authenticationGet($responseCode, $responseHeaders); + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; - // Find default response message - $message = ''; + $handler->authenticationGet($responseCode, $responseHeaders); - // Find a more specific message, if available - switch ($responseCode) { + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -181,87 +186,88 @@ public function authenticationGetAction(Request $request) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation authenticationOauthPost. - * - * OAuth Login - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function authenticationOauthPostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - - // Read out all input parameter values into variables - $o_auth_login_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $o_auth_login_request = $this->deserialize($o_auth_login_request, 'OpenAPI\Server\Model\OAuthLoginRequest', $inputFormat); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\OAuthLoginRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($o_auth_login_request, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->authenticationOauthPost($o_auth_login_request, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation authenticationOauthPost + * + * OAuth Login + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationOauthPostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $o_auth_login_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $o_auth_login_request = $this->deserialize($o_auth_login_request, 'OpenAPI\Server\Model\OAuthLoginRequest', $inputFormat); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\OAuthLoginRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($o_auth_login_request, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->authenticationOauthPost($o_auth_login_request, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -282,94 +288,94 @@ public function authenticationOauthPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation authenticationPost. - * - * Login - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function authenticationPostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $login_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $login_request = $this->deserialize($login_request, 'OpenAPI\Server\Model\LoginRequest', $inputFormat); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\LoginRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($login_request, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->authenticationPost($login_request, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation authenticationPost + * + * Login + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationPostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $login_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $login_request = $this->deserialize($login_request, 'OpenAPI\Server\Model\LoginRequest', $inputFormat); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\LoginRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($login_request, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->authenticationPost($login_request, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -387,94 +393,94 @@ public function authenticationPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation authenticationRefreshPost. - * - * Refresh token - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function authenticationRefreshPostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $refresh_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $refresh_request = $this->deserialize($refresh_request, 'OpenAPI\Server\Model\RefreshRequest', $inputFormat); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\RefreshRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($refresh_request, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->authenticationRefreshPost($refresh_request, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation authenticationRefreshPost + * + * Refresh token + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationRefreshPostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $refresh_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $refresh_request = $this->deserialize($refresh_request, 'OpenAPI\Server\Model\RefreshRequest', $inputFormat); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\RefreshRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($refresh_request, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->authenticationRefreshPost($refresh_request, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -492,88 +498,89 @@ public function authenticationRefreshPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation authenticationUpgradePost. - * - * Upgrade a deprecated token to JWT - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function authenticationUpgradePostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - - // Read out all input parameter values into variables - $upgrade_token_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $upgrade_token_request = $this->deserialize($upgrade_token_request, 'OpenAPI\Server\Model\UpgradeTokenRequest', $inputFormat); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\UpgradeTokenRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($upgrade_token_request, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->authenticationUpgradePost($upgrade_token_request, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation authenticationUpgradePost + * + * Upgrade a deprecated token to JWT + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function authenticationUpgradePostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $upgrade_token_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $upgrade_token_request = $this->deserialize($upgrade_token_request, 'OpenAPI\Server\Model\UpgradeTokenRequest', $inputFormat); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\UpgradeTokenRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($upgrade_token_request, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->authenticationUpgradePost($upgrade_token_request, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -591,29 +598,28 @@ public function authenticationUpgradePostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return AuthenticationApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('authentication'); } - } - - /** - * Returns the handler for this API controller. - * - * @return AuthenticationApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('authentication'); - } } diff --git a/Controller/Controller.php b/Controller/Controller.php index 93c0f641..2dfbee8a 100644 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -1,24 +1,24 @@ validator = $validator; - - return $this; - } - - public function setSerializer(SerializerInterface $serializer): self - { - $this->serializer = $serializer; - - return $this; - } - - public function setApiServer(ApiServer $server): self - { - $this->apiServer = $server; - - return $this; - } - - /** - * This will return a response with code 400. Usage example: - * return $this->createBadRequestResponse('Unable to access this page!');. - * - * @param string $message A message - */ - public function createBadRequestResponse(string $message = 'Bad Request.'): Response - { - return new Response($message, 400); - } - - /** - * This will return an error response. Usage example: - * return $this->createErrorResponse(new UnauthorizedHttpException());. - * - * @param HttpException $exception An HTTP exception - */ - public function createErrorResponse(HttpException $exception): Response - { - $statusCode = $exception->getStatusCode(); - $headers = array_merge($exception->getHeaders(), ['Content-Type' => 'application/json']); - - $json = $this->exceptionToArray($exception); - $json['statusCode'] = $statusCode; - - return new Response(json_encode($json, 15, 512), $statusCode, $headers); - } - - /** - * Serializes data to a given type format. - * - * @param mixed $data the data to serialize - * @param string $format the target serialization format - * - * @return string a serialized data string - */ - protected function serialize($data, string $format): string - { - return $this->serializer->serialize($data, $format); - } - - /** - * Deserializes data from a given type format. - * - * @param string $data the data to deserialize - * @param string $class the target data class - * @param string $format the source serialization format - * - * @return mixed a deserialized data - */ - protected function deserialize(string $data, string $class, string $format) - { - return $this->serializer->deserialize($data, $class, $format); - } - - /** - * @param mixed $data - * @param mixed $asserts - */ - protected function validate($data, $asserts = null): ?Response - { - $errors = $this->validator->validate($data, $asserts); - - if (count($errors) > 0) { - $errorsString = ''; - /** @var ConstraintViolation $violation */ - foreach ($errors as $violation) { - $errorsString .= $violation->getMessage()."\n"; - } - - return $this->createBadRequestResponse($errorsString); + protected ValidatorInterface $validator; + protected SerializerInterface $serializer; + protected ApiServer $apiServer; + + public function setValidator(ValidatorInterface $validator): self + { + $this->validator = $validator; + + return $this; + } + + public function setSerializer(SerializerInterface $serializer): self + { + $this->serializer = $serializer; + + return $this; } - return null; - } + public function setApiServer(ApiServer $server): self + { + $this->apiServer = $server; - /** - * Converts an exception to a serializable array. - */ - private function exceptionToArray(\Throwable $exception = null): ?array - { - if (null === $exception) { - return null; + return $this; } - if (!$this->container->get('kernel')->isDebug()) { - return [ - 'message' => $exception->getMessage(), - ]; + /** + * This will return a response with code 400. Usage example: + * return $this->createBadRequestResponse('Unable to access this page!'); + * + * @param string $message A message + * + * @return Response + */ + public function createBadRequestResponse(string $message = 'Bad Request.'): Response + { + return new Response($message, 400); } - return [ - 'message' => $exception->getMessage(), - 'type' => get_class($exception), - 'previous' => $this->exceptionToArray($exception->getPrevious()), - ]; - } - - /** - * Converts an exception to a serializable array. - * - * @return ?string - */ - protected function getOutputFormat(string $accept, array $produced): ?string - { - // Figure out what the client accepts - $accept = preg_split('/[\\s,]+/', $accept); - - if (in_array('*/*', $accept, true) || in_array('application/*', $accept, true)) { - // Prefer JSON if the client has no preference - if (in_array('application/json', $produced, true)) { - return 'application/json'; - } - if (in_array('application/xml', $produced, true)) { - return 'application/xml'; - } + /** + * This will return an error response. Usage example: + * return $this->createErrorResponse(new UnauthorizedHttpException()); + * + * @param HttpException $exception An HTTP exception + * + * @return Response + */ + public function createErrorResponse(HttpException $exception): Response + { + $statusCode = $exception->getStatusCode(); + $headers = array_merge($exception->getHeaders(), ['Content-Type' => 'application/json']); + + $json = $this->exceptionToArray($exception); + $json['statusCode'] = $statusCode; + + return new Response(json_encode($json, 15, 512), $statusCode, $headers); } - if (in_array('application/json', $accept, true) && in_array('application/json', $produced, true)) { - return 'application/json'; + /** + * Serializes data to a given type format. + * + * @param mixed $data The data to serialize. + * @param string $format The target serialization format. + * + * @return string A serialized data string. + */ + protected function serialize($data, string $format): string + { + return $this->serializer->serialize($data, $format); } - if (in_array('application/xml', $accept, true) && in_array('application/xml', $produced, true)) { - return 'application/xml'; + /** + * Deserializes data from a given type format. + * + * @param string $data The data to deserialize. + * @param string $class The target data class. + * @param string $format The source serialization format. + * + * @return mixed A deserialized data. + */ + protected function deserialize(string $data, string $class, string $format) + { + return $this->serializer->deserialize($data, $class, $format); } - // If we reach this point, we don't have a common ground between server and client - return null; - } - - /** - * Checks whether Content-Type request header presented in supported formats. - * - * @param Request $request request instance - * @param array $consumes array of supported content types - * - * @return bool returns true if Content-Type supported otherwise false - */ - public static function isContentTypeAllowed(Request $request, array $consumes = []): bool - { - if (!empty($consumes) && '*/*' !== $consumes[0]) { - $currentFormat = $request->getContentType(); - foreach ($consumes as $mimeType) { - // canonize mime type - if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { - $mimeType = trim(substr($mimeType, 0, $pos)); + /** + * @param mixed $data + * @param mixed $asserts + * + * @return Response|null + */ + protected function validate($data, $asserts = null): ?Response + { + $errors = $this->validator->validate($data, $asserts); + + if (count($errors) > 0) { + $errorsString = ''; + /** @var ConstraintViolation $violation */ + foreach ($errors as $violation) { + $errorsString .= $violation->getMessage()."\n"; + } + return $this->createBadRequestResponse($errorsString); } - if (!$format = $request->getFormat($mimeType)) { - // add custom format to request - $format = $mimeType; - $request->setFormat($format, $format); - $currentFormat = $request->getContentType(); + return null; + } + + /** + * Converts an exception to a serializable array. + * + * @param \Throwable|null $exception + * + * @return array|null + */ + private function exceptionToArray(\Throwable $exception = null): ?array + { + if (null === $exception) { + return null; } - if ($format === $currentFormat) { - return true; + if (!$this->container->get('kernel')->isDebug()) { + return [ + 'message' => $exception->getMessage(), + ]; } - } - return false; + return [ + 'message' => $exception->getMessage(), + 'type' => get_class($exception), + 'previous' => $this->exceptionToArray($exception->getPrevious()), + ]; } - return true; - } + /** + * Converts an exception to a serializable array. + * + * @param string $accept + * @param array $produced + * + * @return ?string + */ + protected function getOutputFormat(string $accept, array $produced): ?string + { + // Figure out what the client accepts + $accept = preg_split("/[\s,]+/", $accept); + + if (in_array('*/*', $accept) || in_array('application/*', $accept)) { + // Prefer JSON if the client has no preference + if (in_array('application/json', $produced)) { + return 'application/json'; + } + if (in_array('application/xml', $produced)) { + return 'application/xml'; + } + } + + if (in_array('application/json', $accept) && in_array('application/json', $produced)) { + return 'application/json'; + } + + if (in_array('application/xml', $accept) && in_array('application/xml', $produced)) { + return 'application/xml'; + } + + // If we reach this point, we don't have a common ground between server and client + return null; + } + + /** + * Checks whether Content-Type request header presented in supported formats. + * + * @param Request $request Request instance. + * @param array $consumes Array of supported content types. + * + * @return bool Returns true if Content-Type supported otherwise false. + */ + public static function isContentTypeAllowed(Request $request, array $consumes = []): bool + { + if (!empty($consumes) && $consumes[0] !== '*/*') { + $currentFormat = $request->getContentType(); + foreach ($consumes as $mimeType) { + // canonize mime type + if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { + $mimeType = trim(substr($mimeType, 0, $pos)); + } + + if (!$format = $request->getFormat($mimeType)) { + // add custom format to request + $format = $mimeType; + $request->setFormat($format, $format); + $currentFormat = $request->getContentType(); + } + + if ($format === $currentFormat) { + return true; + } + } + + return false; + } + + return true; + } } diff --git a/Controller/MediaLibraryController.php b/Controller/MediaLibraryController.php index fd5790fa..a75b2f2f 100644 --- a/Controller/MediaLibraryController.php +++ b/Controller/MediaLibraryController.php @@ -2,23 +2,23 @@ /** * MediaLibraryController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,91 +29,92 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\MediaLibraryApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\MediaLibraryApiInterface; +use OpenAPI\Server\Model\MediaFileResponse; /** - * MediaLibraryController Class Doc Comment. + * MediaLibraryController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class MediaLibraryController extends Controller { - /** - * Operation mediaFileIdGet. - * - * Get the information of a specific media file - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function mediaFileIdGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $attributes = $request->query->get('attributes', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('int'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->mediaFileIdGet($id, $attributes, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation mediaFileIdGet + * + * Get the information of a specific media file + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function mediaFileIdGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $attributes = $request->query->get('attributes', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("int"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->mediaFileIdGet($id, $attributes, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -128,105 +129,106 @@ public function mediaFileIdGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation mediaFilesGet. - * - * Get *all* content of the media library. - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function mediaFilesGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - $result = $handler->mediaFilesGet($limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation mediaFilesGet + * + * Get *all* content of the media library. + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function mediaFilesGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->mediaFilesGet($limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -238,122 +240,123 @@ public function mediaFilesGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation mediaFilesSearchGet. - * - * Search for mediafiles associated with keywords - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function mediaFilesSearchGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $query = $request->query->get('query'); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - $package_name = $request->query->get('package_name'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $query = $this->deserialize($query, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - $package_name = $this->deserialize($package_name, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($query, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($package_name, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->mediaFilesSearchGet($query, $limit, $offset, $attributes, $flavor, $package_name, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation mediaFilesSearchGet + * + * Search for mediafiles associated with keywords + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function mediaFilesSearchGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $query = $request->query->get('query'); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + $package_name = $request->query->get('package_name'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $query = $this->deserialize($query, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + $package_name = $this->deserialize($package_name, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($query, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($package_name, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->mediaFilesSearchGet($query, $limit, $offset, $attributes, $flavor, $package_name, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -365,107 +368,107 @@ public function mediaFilesSearchGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation mediaPackageNameGet. - * - * Get media-library asstes of a named package - * - * @param Request $request the Symfony request to handle - * @param mixed $name - * - * @return Response the Symfony response - */ - public function mediaPackageNameGetAction(Request $request, $name) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - - // Read out all input parameter values into variables - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $name = $this->deserialize($name, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+$/'); - $response = $this->validate($name, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->mediaPackageNameGet($name, $limit, $offset, $attributes, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation mediaPackageNameGet + * + * Get media-library asstes of a named package + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function mediaPackageNameGetAction(Request $request, $name) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $name = $this->deserialize($name, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+$/"); + $response = $this->validate($name, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->mediaPackageNameGet($name, $limit, $offset, $attributes, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -480,29 +483,28 @@ public function mediaPackageNameGetAction(Request $request, $name) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return MediaLibraryApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('mediaLibrary'); } - } - - /** - * Returns the handler for this API controller. - * - * @return MediaLibraryApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('mediaLibrary'); - } } diff --git a/Controller/NotificationsController.php b/Controller/NotificationsController.php index 5668bb6a..2f0ac150 100644 --- a/Controller/NotificationsController.php +++ b/Controller/NotificationsController.php @@ -2,23 +2,23 @@ /** * NotificationsController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,88 +29,89 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\NotificationsApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\NotificationsApiInterface; +use OpenAPI\Server\Model\NotificationResponse; +use OpenAPI\Server\Model\NotificationsCountResponse; /** - * NotificationsController Class Doc Comment. + * NotificationsController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class NotificationsController extends Controller { - /** - * Operation notificationIdReadPut. - * - * Mark specified notification as read - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function notificationIdReadPutAction(Request $request, $id) - { - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'int', 'string'); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; - $handler->notificationIdReadPut($id, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation notificationIdReadPut + * + * Mark specified notification as read + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function notificationIdReadPutAction(Request $request, $id) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'int', 'string'); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; + + $handler->notificationIdReadPut($id, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'No Content'; break; @@ -122,69 +123,69 @@ public function notificationIdReadPutAction(Request $request, $id) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation notificationsCountGet. - * - * Count the number of unseen notifications - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function notificationsCountGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); + /** + * Operation notificationsCountGet + * + * Count the number of unseen notifications + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function notificationsCountGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); - // Read out all input parameter values into variables + // Read out all input parameter values into variables - // Use the default value if no value was provided + // Use the default value if no value was provided - // Validate the input values + // Validate the input values - try { - $handler = $this->getApiHandler(); - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); + try { + $handler = $this->getApiHandler(); - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); - $result = $handler->notificationsCountGet($responseCode, $responseHeaders); + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; - // Find default response message - $message = ''; + $result = $handler->notificationsCountGet($responseCode, $responseHeaders); - // Find a more specific message, if available - switch ($responseCode) { + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -196,120 +197,120 @@ public function notificationsCountGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation notificationsGet. - * - * Get user notifications -- StatusCode: 501 - Not yet implemented - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function notificationsGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $type = $request->query->get('type', 'all'); - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $type = $this->deserialize($type, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - $asserts = []; - $asserts[] = new Assert\Choice(['all', 'reaction', 'follow', 'comment', 'remix']); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($type, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->notificationsGet($accept_language, $limit, $offset, $attributes, $type, $responseCode, $responseHeaders); - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation notificationsGet + * + * Get user notifications -- StatusCode: 501 - Not yet implemented + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function notificationsGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $type = $request->query->get('type', 'all'); + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $type = $this->deserialize($type, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Choice([ "all", "reaction", "follow", "comment", "remix" ]); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($type, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->notificationsGet($accept_language, $limit, $offset, $attributes, $type, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -321,61 +322,61 @@ public function notificationsGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - } - /** - * Operation notificationsReadPut. - * - * Mark all notifications as read - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function notificationsReadPutAction(Request $request) - { - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); + /** + * Operation notificationsReadPut + * + * Mark all notifications as read + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function notificationsReadPutAction(Request $request) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables - // Read out all input parameter values into variables + // Use the default value if no value was provided - // Use the default value if no value was provided + // Validate the input values - // Validate the input values - try { - $handler = $this->getApiHandler(); + try { + $handler = $this->getApiHandler(); - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; - $handler->notificationsReadPut($responseCode, $responseHeaders); + $handler->notificationsReadPut($responseCode, $responseHeaders); - // Find default response message - $message = ''; + // Find default response message + $message = ''; - // Find a more specific message, if available - switch ($responseCode) { + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'No Content'; break; @@ -390,28 +391,27 @@ public function notificationsReadPutAction(Request $request) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return NotificationsApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('notifications'); } - } - - /** - * Returns the handler for this API controller. - * - * @return NotificationsApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('notifications'); - } } diff --git a/Controller/ProjectsController.php b/Controller/ProjectsController.php index 7df88182..5ef913c8 100644 --- a/Controller/ProjectsController.php +++ b/Controller/ProjectsController.php @@ -2,23 +2,23 @@ /** * ProjectsController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,83 +29,93 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\ProjectsApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\ProjectsApiInterface; +use OpenAPI\Server\Model\ExtensionResponse; +use OpenAPI\Server\Model\FeaturedProjectResponse; +use OpenAPI\Server\Model\ProjectReportRequest; +use OpenAPI\Server\Model\ProjectResponse; +use OpenAPI\Server\Model\ProjectsCategory; +use OpenAPI\Server\Model\TagResponse; +use OpenAPI\Server\Model\UpdateProjectErrorResponse; +use OpenAPI\Server\Model\UpdateProjectFailureResponse; +use OpenAPI\Server\Model\UpdateProjectRequest; +use OpenAPI\Server\Model\UploadErrorResponse; /** - * ProjectsController Class Doc Comment. + * ProjectsController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class ProjectsController extends Controller { - /** - * Operation projectIdCatrobatGet. - * - * Download the .catrobat (=zip) file of a project - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdCatrobatGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/zip']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectIdCatrobatGet($id, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation projectIdCatrobatGet + * + * Download the .catrobat (=zip) file of a project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdCatrobatGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/zip']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectIdCatrobatGet($id, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = '.catrobat file successfully downloaded'; break; @@ -120,77 +130,76 @@ public function projectIdCatrobatGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectIdDelete. - * - * Delete a project - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdDeleteAction(Request $request, $id) - { - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; - - $handler->projectIdDelete($id, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectIdDelete + * + * Delete a project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdDeleteAction(Request $request, $id) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; + + $handler->projectIdDelete($id, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'Project successfully deleted'; break; @@ -208,79 +217,79 @@ public function projectIdDeleteAction(Request $request, $id) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectIdGet. - * - * Get the information of a project - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectIdGet($id, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectIdGet + * + * Get the information of a project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectIdGet($id, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -295,112 +304,111 @@ public function projectIdGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectIdPut. - * - * Update details of a project - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdPutAction(Request $request, $id) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - $update_project_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - $inputFormat = $request->getMimeType($request->getContentType()); - $update_project_request = $this->deserialize($update_project_request, 'OpenAPI\Server\Model\UpdateProjectRequest', $inputFormat); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\UpdateProjectRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($update_project_request, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectIdPut($id, $update_project_request, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectIdPut + * + * Update details of a project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdPutAction(Request $request, $id) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + $update_project_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + $inputFormat = $request->getMimeType($request->getContentType()); + $update_project_request = $this->deserialize($update_project_request, 'OpenAPI\Server\Model\UpdateProjectRequest', $inputFormat); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\UpdateProjectRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($update_project_request, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectIdPut($id, $update_project_request, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'Project successfully updated'; break; @@ -424,141 +432,141 @@ public function projectIdPutAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectIdRecommendationsGet. - * - * Get recommended projects related to the specific project - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdRecommendationsGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $category = $request->query->get('category'); - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - $category = $this->deserialize($category, 'string', 'string'); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Choice(['similar', 'also_downloaded', 'more_from_user']); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($category, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectIdRecommendationsGet($id, $category, $accept_language, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectIdRecommendationsGet + * + * Get recommended projects related to the specific project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdRecommendationsGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $category = $request->query->get('category'); + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + $category = $this->deserialize($category, 'string', 'string'); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Choice([ "similar", "also_downloaded", "more_from_user" ]); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($category, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectIdRecommendationsGet($id, $category, $accept_language, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -570,95 +578,94 @@ public function projectIdRecommendationsGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectIdReportPost. - * - * Report a project -- StatusCode: 501 - Not yet implemented - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectIdReportPostAction(Request $request, $id) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $project_report_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - $inputFormat = $request->getMimeType($request->getContentType()); - $project_report_request = $this->deserialize($project_report_request, 'OpenAPI\Server\Model\ProjectReportRequest', $inputFormat); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\ProjectReportRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($project_report_request, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; - - $handler->projectIdReportPost($id, $project_report_request, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectIdReportPost + * + * Report a project -- StatusCode: 501 - Not yet implemented + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectIdReportPostAction(Request $request, $id) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $project_report_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + $inputFormat = $request->getMimeType($request->getContentType()); + $project_report_request = $this->deserialize($project_report_request, 'OpenAPI\Server\Model\ProjectReportRequest', $inputFormat); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\ProjectReportRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($project_report_request, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; + + $handler->projectIdReportPost($id, $project_report_request, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'Project successfully reported'; break; @@ -676,93 +683,94 @@ public function projectIdReportPostAction(Request $request, $id) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsCategoriesGet. - * - * Get default number of projects per category (Most downloaded etc.) - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsCategoriesGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $max_version = $request->query->get('max_version', ''); - $flavor = $request->query->get('flavor', ''); - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $max_version = $this->deserialize($max_version, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsCategoriesGet($max_version, $flavor, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsCategoriesGet + * + * Get default number of projects per category (Most downloaded etc.) + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsCategoriesGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $max_version = $request->query->get('max_version', ''); + $flavor = $request->query->get('flavor', ''); + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $max_version = $this->deserialize($max_version, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsCategoriesGet($max_version, $flavor, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -774,78 +782,79 @@ public function projectsCategoriesGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsExtensionsGet. - * - * Get all possible project extensions. Extensions are automatically added to projects based on their bricks. - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsExtensionsGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsExtensionsGet($accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsExtensionsGet + * + * Get all possible project extensions. Extensions are automatically added to projects based on their bricks. + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsExtensionsGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsExtensionsGet($accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -854,122 +863,123 @@ public function projectsExtensionsGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsFeaturedGet. - * - * Get the currently featured projects - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsFeaturedGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $platform = $request->query->get('platform', ''); - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $platform = $this->deserialize($platform, 'string', 'string'); - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Choice(['', 'android', 'ios']); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($platform, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsFeaturedGet($platform, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsFeaturedGet + * + * Get the currently featured projects + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsFeaturedGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $platform = $request->query->get('platform', ''); + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $platform = $this->deserialize($platform, 'string', 'string'); + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Choice([ "", "android", "ios" ]); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($platform, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsFeaturedGet($platform, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -981,131 +991,132 @@ public function projectsFeaturedGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsGet. - * - * Get projects - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $category = $request->query->get('category'); - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $category = $this->deserialize($category, 'string', 'string'); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Choice(['recent', 'random', 'most_viewed', 'most_downloaded', 'example', 'scratch', 'recommended']); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($category, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsGet($category, $accept_language, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsGet + * + * Get projects + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $category = $request->query->get('category'); + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $category = $this->deserialize($category, 'string', 'string'); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Choice([ "recent", "random", "most_viewed", "most_downloaded", "example", "scratch", "recommended" ]); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($category, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsGet($category, $accept_language, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -1117,117 +1128,117 @@ public function projectsGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsPost. - * - * Upload a catrobat project - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsPostAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - $checksum = $request->request->get('checksum'); - $file = $request->files->get('file'); - $flavor = $request->request->get('flavor'); - $private = $request->request->get('private'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $checksum = $this->deserialize($checksum, 'string', 'string'); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - $private = $this->deserialize($private, 'bool', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($checksum, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\File(); - $response = $this->validate($file, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('bool'); - $response = $this->validate($private, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsPost($checksum, $file, $accept_language, $flavor, $private, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsPost + * + * Upload a catrobat project + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsPostAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + $checksum = $request->request->get('checksum'); + $file = $request->files->get('file'); + $flavor = $request->request->get('flavor'); + $private = $request->request->get('private'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $checksum = $this->deserialize($checksum, 'string', 'string'); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + $private = $this->deserialize($private, 'bool', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($checksum, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\File(); + $response = $this->validate($file, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("bool"); + $response = $this->validate($private, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsPost($checksum, $file, $accept_language, $flavor, $private, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 201: $message = 'Project successfully uploaded'; break; @@ -1248,122 +1259,123 @@ public function projectsPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsSearchGet. - * - * Search for projects associated with a keywords - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsSearchGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $query = $request->query->get('query'); - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $query = $this->deserialize($query, 'string', 'string'); - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($query, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsSearchGet($query, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsSearchGet + * + * Search for projects associated with a keywords + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsSearchGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $query = $request->query->get('query'); + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $query = $this->deserialize($query, 'string', 'string'); + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($query, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsSearchGet($query, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -1375,78 +1387,79 @@ public function projectsSearchGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsTagsGet. - * - * Get all possible project tags. Some Tags will only be availabe during events. - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsTagsGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsTagsGet($accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsTagsGet + * + * Get all possible project tags. Some Tags will only be availabe during events. + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsTagsGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsTagsGet($accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -1455,119 +1468,119 @@ public function projectsTagsGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsUserGet. - * - * Get the projects of the logged in user - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function projectsUserGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsUserGet($max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsUserGet + * + * Get the projects of the logged in user + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsUserGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsUserGet($max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -1585,123 +1598,123 @@ public function projectsUserGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation projectsUserIdGet. - * - * Get the public projects of a given user - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function projectsUserIdGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $max_version = $request->query->get('max_version', ''); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - $flavor = $request->query->get('flavor', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - $max_version = $this->deserialize($max_version, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($max_version, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->projectsUserIdGet($id, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation projectsUserIdGet + * + * Get the public projects of a given user + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function projectsUserIdGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $max_version = $request->query->get('max_version', ''); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + $max_version = $this->deserialize($max_version, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($max_version, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->projectsUserIdGet($id, $max_version, $limit, $offset, $attributes, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -1716,29 +1729,28 @@ public function projectsUserIdGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return ProjectsApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('projects'); } - } - - /** - * Returns the handler for this API controller. - * - * @return ProjectsApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('projects'); - } } diff --git a/Controller/SearchController.php b/Controller/SearchController.php index d5083b09..637025d3 100644 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -2,23 +2,23 @@ /** * SearchController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,109 +29,111 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\SearchApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\SearchApiInterface; +use OpenAPI\Server\Model\SearchResponse; /** - * SearchController Class Doc Comment. + * SearchController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class SearchController extends Controller { - /** - * Operation searchGet. - * - * Search for projects, users,.. - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function searchGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $query = $request->query->get('query'); - $type = $request->query->get('type'); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $query = $this->deserialize($query, 'string', 'string'); - $type = $this->deserialize($type, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($query, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Choice(['all', 'projects', 'users']); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($type, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->searchGet($query, $type, $limit, $offset, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation searchGet + * + * Search for projects, users,.. + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function searchGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $query = $request->query->get('query'); + $type = $request->query->get('type'); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $query = $this->deserialize($query, 'string', 'string'); + $type = $this->deserialize($type, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($query, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Choice([ "all", "projects", "users" ]); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($type, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->searchGet($query, $type, $limit, $offset, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -143,29 +145,28 @@ public function searchGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return SearchApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('search'); } - } - - /** - * Returns the handler for this API controller. - * - * @return SearchApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('search'); - } } diff --git a/Controller/UserController.php b/Controller/UserController.php index 64f06157..0b1420a6 100644 --- a/Controller/UserController.php +++ b/Controller/UserController.php @@ -2,23 +2,23 @@ /** * UserController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,64 +29,73 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\UserApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\UserApiInterface; +use OpenAPI\Server\Model\BasicUserDataResponse; +use OpenAPI\Server\Model\ExtendedUserDataResponse; +use OpenAPI\Server\Model\JWTResponse; +use OpenAPI\Server\Model\RegisterErrorResponse; +use OpenAPI\Server\Model\RegisterRequest; +use OpenAPI\Server\Model\ResetPasswordErrorResponse; +use OpenAPI\Server\Model\ResetPasswordRequest; +use OpenAPI\Server\Model\UpdateUserErrorResponse; +use OpenAPI\Server\Model\UpdateUserRequest; /** - * UserController Class Doc Comment. + * UserController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class UserController extends Controller { - /** - * Operation userDelete. - * - * Delete user account - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function userDeleteAction(Request $request) - { - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - // Read out all input parameter values into variables + /** + * Operation userDelete + * + * Delete user account + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userDeleteAction(Request $request) + { + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); - // Use the default value if no value was provided + // Read out all input parameter values into variables - // Validate the input values + // Use the default value if no value was provided - try { - $handler = $this->getApiHandler(); + // Validate the input values - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; + try { + $handler = $this->getApiHandler(); - $handler->userDelete($responseCode, $responseHeaders); + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); - // Find default response message - $message = ''; + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; - // Find a more specific message, if available - switch ($responseCode) { + $handler->userDelete($responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'User successfully deleted.'; break; @@ -95,69 +104,69 @@ public function userDeleteAction(Request $request) break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation userGet. - * - * Get your private user data - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function userGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); + /** + * Operation userGet + * + * Get your private user data + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } - // Read out all input parameter values into variables + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); - // Use the default value if no value was provided + // Read out all input parameter values into variables - // Validate the input values + // Use the default value if no value was provided - try { - $handler = $this->getApiHandler(); + // Validate the input values - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; + try { + $handler = $this->getApiHandler(); - $result = $handler->userGet($responseCode, $responseHeaders); + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); - // Find default response message - $message = ''; + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; - // Find a more specific message, if available - switch ($responseCode) { + $result = $handler->userGet($responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -172,80 +181,80 @@ public function userGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation userIdGet. - * - * Get public user data - * - * @param Request $request the Symfony request to handle - * @param mixed $id - * - * @return Response the Symfony response - */ - public function userIdGetAction(Request $request, $id) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $id = $this->deserialize($id, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-]+$/'); - $response = $this->validate($id, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->userIdGet($id, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation userIdGet + * + * Get public user data + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userIdGetAction(Request $request, $id) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $id = $this->deserialize($id, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-]+$/"); + $response = $this->validate($id, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->userIdGet($id, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -257,96 +266,97 @@ public function userIdGetAction(Request $request, $id) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation userPost. - * - * Register - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function userPostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - $register_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $register_request = $this->deserialize($register_request, 'OpenAPI\Server\Model\RegisterRequest', $inputFormat); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\RegisterRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($register_request, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->userPost($register_request, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation userPost + * + * Register + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userPostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + $register_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $register_request = $this->deserialize($register_request, 'OpenAPI\Server\Model\RegisterRequest', $inputFormat); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\RegisterRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($register_request, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->userPost($register_request, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 201: $message = 'User successfully registered'; break; @@ -367,102 +377,102 @@ public function userPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation userPut. - * - * Update User - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function userPutAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - // Authentication 'PandaAuth' required - // HTTP basic authentication required - $securityPandaAuth = $request->headers->get('authorization'); - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - $update_user_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $update_user_request = $this->deserialize($update_user_request, 'OpenAPI\Server\Model\UpdateUserRequest', $inputFormat); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\UpdateUserRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($update_user_request, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Set authentication method 'PandaAuth' - $handler->setPandaAuth($securityPandaAuth); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->userPut($update_user_request, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation userPut + * + * Update User + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userPutAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + // Authentication 'PandaAuth' required + // HTTP basic authentication required + $securityPandaAuth = $request->headers->get('authorization'); + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + $update_user_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $update_user_request = $this->deserialize($update_user_request, 'OpenAPI\Server\Model\UpdateUserRequest', $inputFormat); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\UpdateUserRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($update_user_request, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + // Set authentication method 'PandaAuth' + $handler->setPandaAuth($securityPandaAuth); + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->userPut($update_user_request, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'User successfully updated'; break; @@ -477,96 +487,97 @@ public function userPutAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation userResetPasswordPost. - * - * Request email to reset password - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function userResetPasswordPostAction(Request $request) - { - // Make sure that the client is providing something that we can consume - $consumes = ['application/json']; - if (!static::isContentTypeAllowed($request, $consumes)) { - // We can't consume the content that the client is sending us - return new Response('', 415); - } - - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $accept_language = $request->headers->get('Accept-Language', 'en'); - $reset_password_request = $request->getContent(); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $inputFormat = $request->getMimeType($request->getContentType()); - $reset_password_request = $this->deserialize($reset_password_request, 'OpenAPI\Server\Model\ResetPasswordRequest', $inputFormat); - $accept_language = $this->deserialize($accept_language, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('OpenAPI\\Server\\Model\\ResetPasswordRequest'); - $asserts[] = new Assert\Valid(); - $response = $this->validate($reset_password_request, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($accept_language, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->userResetPasswordPost($reset_password_request, $accept_language, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation userResetPasswordPost + * + * Request email to reset password + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function userResetPasswordPostAction(Request $request) + { + // Make sure that the client is providing something that we can consume + $consumes = ['application/json']; + if (!static::isContentTypeAllowed($request, $consumes)) { + // We can't consume the content that the client is sending us + return new Response('', 415); + } + + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $accept_language = $request->headers->get('Accept-Language', 'en'); + $reset_password_request = $request->getContent(); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $inputFormat = $request->getMimeType($request->getContentType()); + $reset_password_request = $this->deserialize($reset_password_request, 'OpenAPI\Server\Model\ResetPasswordRequest', $inputFormat); + $accept_language = $this->deserialize($accept_language, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("OpenAPI\Server\Model\ResetPasswordRequest"); + $asserts[] = new Assert\Valid(); + $response = $this->validate($reset_password_request, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($accept_language, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->userResetPasswordPost($reset_password_request, $accept_language, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'If an account with this email exists, an email to reset the password will be send to the user'; break; @@ -584,106 +595,107 @@ public function userResetPasswordPostAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); - } - } - - /** - * Operation usersSearchGet. - * - * Search for users - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function usersSearchGetAction(Request $request) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $query = $request->query->get('query'); - $limit = $request->query->get('limit', 20); - $offset = $request->query->get('offset', 0); - $attributes = $request->query->get('attributes', ''); - - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $query = $this->deserialize($query, 'string', 'string'); - $limit = $this->deserialize($limit, 'int', 'string'); - $offset = $this->deserialize($offset, 'int', 'string'); - $attributes = $this->deserialize($attributes, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($query, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($limit, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('int'); - $asserts[] = new Assert\GreaterThanOrEqual(0); - $response = $this->validate($offset, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $asserts[] = new Assert\Regex('/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/'); - $response = $this->validate($attributes, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->usersSearchGet($query, $limit, $offset, $attributes, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Operation usersSearchGet + * + * Search for users + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function usersSearchGetAction(Request $request) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $query = $request->query->get('query'); + $limit = $request->query->get('limit', 20); + $offset = $request->query->get('offset', 0); + $attributes = $request->query->get('attributes', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $query = $this->deserialize($query, 'string', 'string'); + $limit = $this->deserialize($limit, 'int', 'string'); + $offset = $this->deserialize($offset, 'int', 'string'); + $attributes = $this->deserialize($attributes, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($query, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($limit, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("int"); + $asserts[] = new Assert\GreaterThanOrEqual(0); + $response = $this->validate($offset, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $asserts[] = new Assert\Regex("/^[a-zA-Z0-9\\-_]+(,[a-zA-Z0-9\\-_]+)*$/"); + $response = $this->validate($attributes, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->usersSearchGet($query, $limit, $offset, $attributes, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -695,29 +707,28 @@ public function usersSearchGetAction(Request $request) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return UserApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('user'); } - } - - /** - * Returns the handler for this API controller. - * - * @return UserApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('user'); - } } diff --git a/Controller/UtilityController.php b/Controller/UtilityController.php index 2d920233..60f56e66 100644 --- a/Controller/UtilityController.php +++ b/Controller/UtilityController.php @@ -2,23 +2,23 @@ /** * UtilityController - * PHP version 8.1.1. + * PHP version 8.1.1 * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ /** - * Catroweb API. + * Catroweb API * * API for the Catrobat Share Platform * - * The version of the OpenAPI document: v1.1.2 + * The version of the OpenAPI document: v1.1.3 * Contact: webmaster@catrobat.org * Generated by: https://github.com/openapitools/openapi-generator.git + * */ /** @@ -29,143 +29,145 @@ namespace OpenAPI\Server\Controller; -use Exception; +use \Exception; use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException; -use OpenAPI\Server\Api\UtilityApiInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\Validator\Constraints as Assert; +use OpenAPI\Server\Api\UtilityApiInterface; +use OpenAPI\Server\Model\SurveyResponse; /** - * UtilityController Class Doc Comment. + * UtilityController Class Doc Comment * * @category Class - * + * @package OpenAPI\Server\Controller * @author OpenAPI Generator team - * - * @see https://github.com/openapitools/openapi-generator + * @link https://github.com/openapitools/openapi-generator */ class UtilityController extends Controller { - /** - * Operation healthGet. - * - * Health Check - * - * @param Request $request the Symfony request to handle - * - * @return Response the Symfony response - */ - public function healthGetAction(Request $request) - { - // Handle authentication - // Read out all input parameter values into variables + /** + * Operation healthGet + * + * Health Check + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function healthGetAction(Request $request) + { + // Handle authentication - // Use the default value if no value was provided + // Read out all input parameter values into variables - // Validate the input values + // Use the default value if no value was provided - try { - $handler = $this->getApiHandler(); + // Validate the input values - // Make the call to the business logic - $responseCode = 204; - $responseHeaders = []; - $handler->healthGet($responseCode, $responseHeaders); + try { + $handler = $this->getApiHandler(); - // Find default response message - $message = ''; - // Find a more specific message, if available - switch ($responseCode) { + // Make the call to the business logic + $responseCode = 204; + $responseHeaders = []; + + $handler->healthGet($responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 204: $message = 'System is alive and healthy!'; break; } - return new Response( + return new Response( '', $responseCode, array_merge( $responseHeaders, [ - 'X-OpenAPI-Message' => $message, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } } - } - - /** - * Operation surveyLangCodeGet. - * - * Get survey link for given language code. - * - * @param Request $request the Symfony request to handle - * @param mixed $lang_code - * - * @return Response the Symfony response - */ - public function surveyLangCodeGetAction(Request $request, $lang_code) - { - // Figure out what data format to return to the client - $produces = ['application/json']; - // Figure out what the client accepts - $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; - $responseFormat = $this->getOutputFormat($clientAccepts, $produces); - if (null === $responseFormat) { - return new Response('', 406); - } - - // Handle authentication - - // Read out all input parameter values into variables - $flavor = $request->query->get('flavor', ''); - // Use the default value if no value was provided - - // Deserialize the input values that needs it - try { - $lang_code = $this->deserialize($lang_code, 'string', 'string'); - $flavor = $this->deserialize($flavor, 'string', 'string'); - } catch (SerializerRuntimeException $exception) { - return $this->createBadRequestResponse($exception->getMessage()); - } - - // Validate the input values - $asserts = []; - $asserts[] = new Assert\NotNull(); - $asserts[] = new Assert\Type('string'); - $response = $this->validate($lang_code, $asserts); - if ($response instanceof Response) { - return $response; - } - $asserts = []; - $asserts[] = new Assert\Type('string'); - $response = $this->validate($flavor, $asserts); - if ($response instanceof Response) { - return $response; - } - - try { - $handler = $this->getApiHandler(); - - // Make the call to the business logic - $responseCode = 200; - $responseHeaders = []; - - $result = $handler->surveyLangCodeGet($lang_code, $flavor, $responseCode, $responseHeaders); - - // Find default response message - $message = ''; - - // Find a more specific message, if available - switch ($responseCode) { + /** + * Operation surveyLangCodeGet + * + * Get survey link for given language code. + * + * @param Request $request The Symfony request to handle. + * @return Response The Symfony response. + */ + public function surveyLangCodeGetAction(Request $request, $lang_code) + { + // Figure out what data format to return to the client + $produces = ['application/json']; + // Figure out what the client accepts + $clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*'; + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); + if ($responseFormat === null) { + return new Response('', 406); + } + + // Handle authentication + + // Read out all input parameter values into variables + $flavor = $request->query->get('flavor', ''); + + // Use the default value if no value was provided + + // Deserialize the input values that needs it + try { + $lang_code = $this->deserialize($lang_code, 'string', 'string'); + $flavor = $this->deserialize($flavor, 'string', 'string'); + } catch (SerializerRuntimeException $exception) { + return $this->createBadRequestResponse($exception->getMessage()); + } + + // Validate the input values + $asserts = []; + $asserts[] = new Assert\NotNull(); + $asserts[] = new Assert\Type("string"); + $response = $this->validate($lang_code, $asserts); + if ($response instanceof Response) { + return $response; + } + $asserts = []; + $asserts[] = new Assert\Type("string"); + $response = $this->validate($flavor, $asserts); + if ($response instanceof Response) { + return $response; + } + + + try { + $handler = $this->getApiHandler(); + + + // Make the call to the business logic + $responseCode = 200; + $responseHeaders = []; + + $result = $handler->surveyLangCodeGet($lang_code, $flavor, $responseCode, $responseHeaders); + + // Find default response message + $message = ''; + + // Find a more specific message, if available + switch ($responseCode) { case 200: $message = 'OK'; break; @@ -180,29 +182,28 @@ public function surveyLangCodeGetAction(Request $request, $lang_code) break; } - return new Response( - null !== $result ? $this->serialize($result, $responseFormat) : '', + return new Response( + $result !== null ?$this->serialize($result, $responseFormat):'', $responseCode, array_merge( $responseHeaders, [ - 'Content-Type' => $responseFormat, - 'X-OpenAPI-Message' => $message, + 'Content-Type' => $responseFormat, + 'X-OpenAPI-Message' => $message ] ) ); - } catch (Exception $fallthrough) { - return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } catch (Exception $fallthrough) { + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); + } + } + + /** + * Returns the handler for this API controller. + * @return UtilityApiInterface + */ + public function getApiHandler() + { + return $this->apiServer->getApiHandler('utility'); } - } - - /** - * Returns the handler for this API controller. - * - * @return UtilityApiInterface - */ - public function getApiHandler() - { - return $this->apiServer->getApiHandler('utility'); - } } diff --git a/DependencyInjection/Compiler/OpenAPIServerApiPass.php b/DependencyInjection/Compiler/OpenAPIServerApiPass.php index a56e1828..7c0985ff 100644 --- a/DependencyInjection/Compiler/OpenAPIServerApiPass.php +++ b/DependencyInjection/Compiler/OpenAPIServerApiPass.php @@ -1,24 +1,24 @@ has('open_api_server.api.api_server')) { - return; - } - $definition = $container->findDefinition('open_api_server.api.api_server'); + /** + * You can modify the container here before it is dumped to PHP code. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) { + // always first check if the primary service is defined + if (!$container->has('open_api_server.api.api_server')) { + return; + } + + $definition = $container->findDefinition('open_api_server.api.api_server'); - // find all service IDs with the open_api_server.api tag - $taggedServices = $container->findTaggedServiceIds('open_api_server.api'); + // find all service IDs with the open_api_server.api tag + $taggedServices = $container->findTaggedServiceIds('open_api_server.api'); - foreach ($taggedServices as $id => $tags) { - foreach ($tags as $tag) { - // add the transport service to the ChainTransport service - $definition->addMethodCall('addApiHandler', [$tag['api'], new Reference($id)]); - } + foreach ($taggedServices as $id => $tags) { + foreach ($tags as $tag) { + // add the transport service to the ChainTransport service + $definition->addMethodCall('addApiHandler', [$tag['api'], new Reference($id)]); + } + } } - } } diff --git a/DependencyInjection/OpenAPIServerExtension.php b/DependencyInjection/OpenAPIServerExtension.php index 99655067..b86082ac 100644 --- a/DependencyInjection/OpenAPIServerExtension.php +++ b/DependencyInjection/OpenAPIServerExtension.php @@ -1,24 +1,24 @@ load('services.yml'); - } + public function load(array $configs, ContainerBuilder $container): void + { + $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yml'); + } - public function getAlias(): string - { - return 'open_api_server'; - } + public function getAlias(): string + { + return 'open_api_server'; + } } diff --git a/Model/BaseUser.php b/Model/BaseUser.php index efc5aaed..3d0d7ade 100644 --- a/Model/BaseUser.php +++ b/Model/BaseUser.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - $this->username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - $this->picture = $data['picture'] ?? null; - $this->about = $data['about'] ?? null; - $this->currently_working_on = $data['currently_working_on'] ?? null; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @param string|null $email Email of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } - - /** - * Sets password. - * - * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @param string|null $picture the profile picture of the user in data URI scheme - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } - - /** - * Gets about. - */ - public function getAbout(): ?string - { - return $this->about; - } - - /** - * Sets about. - * - * @param string|null $about an introduction of the user - * - * @return $this - */ - public function setAbout(string $about = null): self - { - $this->about = $about; - - return $this; - } - - /** - * Gets currently_working_on. - */ - public function getCurrentlyWorkingOn(): ?string - { - return $this->currently_working_on; - } - - /** - * Sets currently_working_on. - * - * @param string|null $currently_working_on a short description about the project the user is currently working on - * - * @return $this - */ - public function setCurrentlyWorkingOn(string $currently_working_on = null): self - { - $this->currently_working_on = $currently_working_on; - - return $this; - } + /** + * Email of the user + * + * @var string|null + * @SerializedName("email") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * Name of the user | minLength: 3 | maxLength: 180 + * + * @var string|null + * @SerializedName("username") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * A secure password | minLength: 6 | maxLength: 4096 + * + * @var string|null + * @SerializedName("password") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $password; + + /** + * The profile picture of the user in data URI scheme. + * + * @var string|null + * @SerializedName("picture") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * An introduction of the user. + * + * @var string|null + * @SerializedName("about") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $about; + + /** + * A short description about the project the user is currently working on. + * + * @var string|null + * @SerializedName("currentlyWorkingOn") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $currently_working_on; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + $this->picture = $data['picture'] ?? null; + $this->about = $data['about'] ?? null; + $this->currently_working_on = $data['currently_working_on'] ?? null; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email Email of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * Sets password. + * + * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture The profile picture of the user in data URI scheme. + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } + + /** + * Gets about. + * + * @return string|null + */ + public function getAbout(): ?string + { + return $this->about; + } + + /** + * Sets about. + * + * @param string|null $about An introduction of the user. + * + * @return $this + */ + public function setAbout(string $about = null): self + { + $this->about = $about; + + return $this; + } + + /** + * Gets currently_working_on. + * + * @return string|null + */ + public function getCurrentlyWorkingOn(): ?string + { + return $this->currently_working_on; + } + + /** + * Sets currently_working_on. + * + * @param string|null $currently_working_on A short description about the project the user is currently working on. + * + * @return $this + */ + public function setCurrentlyWorkingOn(string $currently_working_on = null): self + { + $this->currently_working_on = $currently_working_on; + + return $this; + } } + + diff --git a/Model/BasicUserDataResponse.php b/Model/BasicUserDataResponse.php index a0d4dca6..a9ea8ac0 100644 --- a/Model/BasicUserDataResponse.php +++ b/Model/BasicUserDataResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->username = $data['username'] ?? null; - $this->picture = $data['picture'] ?? null; - $this->about = $data['about'] ?? null; - $this->currently_working_on = $data['currently_working_on'] ?? null; - $this->projects = $data['projects'] ?? null; - $this->followers = $data['followers'] ?? null; - $this->following = $data['following'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * Sets id. - * - * @param string|null $id Unique ID of the user - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @param string|null $username Nickname of the user - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @param string|null $picture the profile picture of the user in data URI scheme - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } - - /** - * Gets about. - */ - public function getAbout(): ?string - { - return $this->about; - } - - /** - * Sets about. - * - * @param string|null $about an introduction of the user - * - * @return $this - */ - public function setAbout(string $about = null): self - { - $this->about = $about; - - return $this; - } - - /** - * Gets currently_working_on. - */ - public function getCurrentlyWorkingOn(): ?string - { - return $this->currently_working_on; - } - - /** - * Sets currently_working_on. - * - * @param string|null $currently_working_on a short description about the project the user is currently working on - * - * @return $this - */ - public function setCurrentlyWorkingOn(string $currently_working_on = null): self - { - $this->currently_working_on = $currently_working_on; - - return $this; - } - - /** - * Gets projects. - */ - public function getProjects(): ?int - { - return $this->projects; - } - - /** - * Sets projects. - * - * @param int|null $projects Amount of projects of the user - * - * @return $this - */ - public function setProjects(int $projects = null): self - { - $this->projects = $projects; - - return $this; - } - - /** - * Gets followers. - */ - public function getFollowers(): ?int - { - return $this->followers; - } - - /** - * Sets followers. - * - * @param int|null $followers Amount of users that follow this user - * - * @return $this - */ - public function setFollowers(int $followers = null): self - { - $this->followers = $followers; - - return $this; - } - - /** - * Gets following. - */ - public function getFollowing(): ?int - { - return $this->following; - } - - /** - * Sets following. - * - * @param int|null $following Amount of users followed by this user - * - * @return $this - */ - public function setFollowing(int $following = null): self - { - $this->following = $following; - - return $this; - } + /** + * Unique ID of the user + * + * @var string|null + * @SerializedName("id") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $id; + + /** + * Nickname of the user + * + * @var string|null + * @SerializedName("username") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * The profile picture of the user in data URI scheme. + * + * @var string|null + * @SerializedName("picture") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * An introduction of the user. + * + * @var string|null + * @SerializedName("about") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $about; + + /** + * A short description about the project the user is currently working on. + * + * @var string|null + * @SerializedName("currentlyWorkingOn") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $currently_working_on; + + /** + * Amount of projects of the user + * + * @var int|null + * @SerializedName("projects") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $projects; + + /** + * Amount of users that follow this user + * + * @var int|null + * @SerializedName("followers") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $followers; + + /** + * Amount of users followed by this user + * + * @var int|null + * @SerializedName("following") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $following; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->username = $data['username'] ?? null; + $this->picture = $data['picture'] ?? null; + $this->about = $data['about'] ?? null; + $this->currently_working_on = $data['currently_working_on'] ?? null; + $this->projects = $data['projects'] ?? null; + $this->followers = $data['followers'] ?? null; + $this->following = $data['following'] ?? null; + } + + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * Sets id. + * + * @param string|null $id Unique ID of the user + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username Nickname of the user + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture The profile picture of the user in data URI scheme. + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } + + /** + * Gets about. + * + * @return string|null + */ + public function getAbout(): ?string + { + return $this->about; + } + + /** + * Sets about. + * + * @param string|null $about An introduction of the user. + * + * @return $this + */ + public function setAbout(string $about = null): self + { + $this->about = $about; + + return $this; + } + + /** + * Gets currently_working_on. + * + * @return string|null + */ + public function getCurrentlyWorkingOn(): ?string + { + return $this->currently_working_on; + } + + /** + * Sets currently_working_on. + * + * @param string|null $currently_working_on A short description about the project the user is currently working on. + * + * @return $this + */ + public function setCurrentlyWorkingOn(string $currently_working_on = null): self + { + $this->currently_working_on = $currently_working_on; + + return $this; + } + + /** + * Gets projects. + * + * @return int|null + */ + public function getProjects(): ?int + { + return $this->projects; + } + + /** + * Sets projects. + * + * @param int|null $projects Amount of projects of the user + * + * @return $this + */ + public function setProjects(int $projects = null): self + { + $this->projects = $projects; + + return $this; + } + + /** + * Gets followers. + * + * @return int|null + */ + public function getFollowers(): ?int + { + return $this->followers; + } + + /** + * Sets followers. + * + * @param int|null $followers Amount of users that follow this user + * + * @return $this + */ + public function setFollowers(int $followers = null): self + { + $this->followers = $followers; + + return $this; + } + + /** + * Gets following. + * + * @return int|null + */ + public function getFollowing(): ?int + { + return $this->following; + } + + /** + * Sets following. + * + * @param int|null $following Amount of users followed by this user + * + * @return $this + */ + public function setFollowing(int $following = null): self + { + $this->following = $following; + + return $this; + } } + + diff --git a/Model/DryRun.php b/Model/DryRun.php index 12534fbd..bf56196d 100644 --- a/Model/DryRun.php +++ b/Model/DryRun.php @@ -1,24 +1,24 @@ dry_run = $data['dry_run'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->dry_run = $data['dry_run'] ?? null; + } - /** - * Gets dry_run. - */ - public function isDryRun(): ?bool - { - return $this->dry_run; - } + /** + * Gets dry_run. + * + * @return bool|null + */ + public function isDryRun(): ?bool + { + return $this->dry_run; + } - /** - * Sets dry_run. - * - * @param bool|null $dry_run Indicates wether a request should only be verified or executed - * - * @return $this - */ - public function setDryRun(bool $dry_run = null): self - { - $this->dry_run = $dry_run; + /** + * Sets dry_run. + * + * @param bool|null $dry_run Indicates wether a request should only be verified or executed + * + * @return $this + */ + public function setDryRun(bool $dry_run = null): self + { + $this->dry_run = $dry_run; - return $this; - } + return $this; + } } + + diff --git a/Model/ExtendedUserDataResponse.php b/Model/ExtendedUserDataResponse.php index 38e797d2..0573fc29 100644 --- a/Model/ExtendedUserDataResponse.php +++ b/Model/ExtendedUserDataResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->username = $data['username'] ?? null; - $this->picture = $data['picture'] ?? null; - $this->about = $data['about'] ?? null; - $this->currently_working_on = $data['currently_working_on'] ?? null; - $this->projects = $data['projects'] ?? null; - $this->followers = $data['followers'] ?? null; - $this->following = $data['following'] ?? null; - $this->email = $data['email'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * Sets id. - * - * @param string|null $id Unique ID of the user - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @param string|null $username Nickname of the user - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @param string|null $picture the profile picture of the user in data URI scheme - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } - - /** - * Gets about. - */ - public function getAbout(): ?string - { - return $this->about; - } - - /** - * Sets about. - * - * @param string|null $about an introduction of the user - * - * @return $this - */ - public function setAbout(string $about = null): self - { - $this->about = $about; - - return $this; - } - - /** - * Gets currently_working_on. - */ - public function getCurrentlyWorkingOn(): ?string - { - return $this->currently_working_on; - } - - /** - * Sets currently_working_on. - * - * @param string|null $currently_working_on a short description about the project the user is currently working on - * - * @return $this - */ - public function setCurrentlyWorkingOn(string $currently_working_on = null): self - { - $this->currently_working_on = $currently_working_on; - - return $this; - } - - /** - * Gets projects. - */ - public function getProjects(): ?int - { - return $this->projects; - } - - /** - * Sets projects. - * - * @param int|null $projects Amount of projects of the user - * - * @return $this - */ - public function setProjects(int $projects = null): self - { - $this->projects = $projects; - - return $this; - } - - /** - * Gets followers. - */ - public function getFollowers(): ?int - { - return $this->followers; - } - - /** - * Sets followers. - * - * @param int|null $followers Amount of users that follow this user - * - * @return $this - */ - public function setFollowers(int $followers = null): self - { - $this->followers = $followers; - - return $this; - } - - /** - * Gets following. - */ - public function getFollowing(): ?int - { - return $this->following; - } - - /** - * Sets following. - * - * @param int|null $following Amount of users followed by this user - * - * @return $this - */ - public function setFollowing(int $following = null): self - { - $this->following = $following; - - return $this; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @param string|null $email EMail of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } + /** + * Unique ID of the user + * + * @var string|null + * @SerializedName("id") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $id; + + /** + * Nickname of the user + * + * @var string|null + * @SerializedName("username") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * The profile picture of the user in data URI scheme. + * + * @var string|null + * @SerializedName("picture") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * An introduction of the user. + * + * @var string|null + * @SerializedName("about") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $about; + + /** + * A short description about the project the user is currently working on. + * + * @var string|null + * @SerializedName("currentlyWorkingOn") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $currently_working_on; + + /** + * Amount of projects of the user + * + * @var int|null + * @SerializedName("projects") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $projects; + + /** + * Amount of users that follow this user + * + * @var int|null + * @SerializedName("followers") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $followers; + + /** + * Amount of users followed by this user + * + * @var int|null + * @SerializedName("following") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $following; + + /** + * EMail of the user + * + * @var string|null + * @SerializedName("email") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->username = $data['username'] ?? null; + $this->picture = $data['picture'] ?? null; + $this->about = $data['about'] ?? null; + $this->currently_working_on = $data['currently_working_on'] ?? null; + $this->projects = $data['projects'] ?? null; + $this->followers = $data['followers'] ?? null; + $this->following = $data['following'] ?? null; + $this->email = $data['email'] ?? null; + } + + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * Sets id. + * + * @param string|null $id Unique ID of the user + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username Nickname of the user + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture The profile picture of the user in data URI scheme. + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } + + /** + * Gets about. + * + * @return string|null + */ + public function getAbout(): ?string + { + return $this->about; + } + + /** + * Sets about. + * + * @param string|null $about An introduction of the user. + * + * @return $this + */ + public function setAbout(string $about = null): self + { + $this->about = $about; + + return $this; + } + + /** + * Gets currently_working_on. + * + * @return string|null + */ + public function getCurrentlyWorkingOn(): ?string + { + return $this->currently_working_on; + } + + /** + * Sets currently_working_on. + * + * @param string|null $currently_working_on A short description about the project the user is currently working on. + * + * @return $this + */ + public function setCurrentlyWorkingOn(string $currently_working_on = null): self + { + $this->currently_working_on = $currently_working_on; + + return $this; + } + + /** + * Gets projects. + * + * @return int|null + */ + public function getProjects(): ?int + { + return $this->projects; + } + + /** + * Sets projects. + * + * @param int|null $projects Amount of projects of the user + * + * @return $this + */ + public function setProjects(int $projects = null): self + { + $this->projects = $projects; + + return $this; + } + + /** + * Gets followers. + * + * @return int|null + */ + public function getFollowers(): ?int + { + return $this->followers; + } + + /** + * Sets followers. + * + * @param int|null $followers Amount of users that follow this user + * + * @return $this + */ + public function setFollowers(int $followers = null): self + { + $this->followers = $followers; + + return $this; + } + + /** + * Gets following. + * + * @return int|null + */ + public function getFollowing(): ?int + { + return $this->following; + } + + /** + * Sets following. + * + * @param int|null $following Amount of users followed by this user + * + * @return $this + */ + public function setFollowing(int $following = null): self + { + $this->following = $following; + + return $this; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email EMail of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } } + + diff --git a/Model/ExtendedUserDataResponseAllOf.php b/Model/ExtendedUserDataResponseAllOf.php index 84aa3744..06371358 100644 --- a/Model/ExtendedUserDataResponseAllOf.php +++ b/Model/ExtendedUserDataResponseAllOf.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + } - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } - /** - * Sets email. - * - * @param string|null $email EMail of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; + /** + * Sets email. + * + * @param string|null $email EMail of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; - return $this; - } + return $this; + } } + + diff --git a/Model/ExtensionResponse.php b/Model/ExtensionResponse.php index e172c306..6ff3adaf 100644 --- a/Model/ExtensionResponse.php +++ b/Model/ExtensionResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->text = $data['text'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->text = $data['text'] ?? null; + } - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } - /** - * Sets id. - * - * @param string|null $id The internal title of the extension - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; + /** + * Sets id. + * + * @param string|null $id The internal title of the extension + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; - return $this; - } + return $this; + } - /** - * Gets text. - */ - public function getText(): ?string - { - return $this->text; - } + /** + * Gets text. + * + * @return string|null + */ + public function getText(): ?string + { + return $this->text; + } - /** - * Sets text. - * - * @param string|null $text the translated text of the project extension - * - * @return $this - */ - public function setText(string $text = null): self - { - $this->text = $text; + /** + * Sets text. + * + * @param string|null $text The translated text of the project extension. + * + * @return $this + */ + public function setText(string $text = null): self + { + $this->text = $text; - return $this; - } + return $this; + } } + + diff --git a/Model/FeaturedProjectResponse.php b/Model/FeaturedProjectResponse.php index 9f7b820f..fc58d5aa 100644 --- a/Model/FeaturedProjectResponse.php +++ b/Model/FeaturedProjectResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->project_id = $data['project_id'] ?? null; - $this->project_url = $data['project_url'] ?? null; - $this->url = $data['url'] ?? null; - $this->name = $data['name'] ?? null; - $this->author = $data['author'] ?? null; - $this->featured_image = $data['featured_image'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * Sets id. - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets project_id. - */ - public function getProjectId(): ?string - { - return $this->project_id; - } - - /** - * Sets project_id. - * - * @return $this - */ - public function setProjectId(string $project_id = null): self - { - $this->project_id = $project_id; - - return $this; - } - - /** - * Gets project_url. - */ - public function getProjectUrl(): ?string - { - return $this->project_url; - } - - /** - * Sets project_url. - * - * @return $this - */ - public function setProjectUrl(string $project_url = null): self - { - $this->project_url = $project_url; - - return $this; - } - - /** - * Gets url. - */ - public function getUrl(): ?string - { - return $this->url; - } - - /** - * Sets url. - * - * @return $this - */ - public function setUrl(string $url = null): self - { - $this->url = $url; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets author. - */ - public function getAuthor(): ?string - { - return $this->author; - } - - /** - * Sets author. - * - * @return $this - */ - public function setAuthor(string $author = null): self - { - $this->author = $author; - - return $this; - } - - /** - * Gets featured_image. - */ - public function getFeaturedImage(): ?string - { - return $this->featured_image; - } - - /** - * Sets featured_image. - * - * @return $this - */ - public function setFeaturedImage(string $featured_image = null): self - { - $this->featured_image = $featured_image; - - return $this; - } + /** + * @var string|null + * @SerializedName("id") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $id; + + /** + * @var string|null + * @SerializedName("project_id") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $project_id; + + /** + * @var string|null + * @SerializedName("project_url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $project_url; + + /** + * @var string|null + * @SerializedName("url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $url; + + /** + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * @var string|null + * @SerializedName("author") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $author; + + /** + * @var string|null + * @SerializedName("featured_image") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $featured_image; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->project_id = $data['project_id'] ?? null; + $this->project_url = $data['project_url'] ?? null; + $this->url = $data['url'] ?? null; + $this->name = $data['name'] ?? null; + $this->author = $data['author'] ?? null; + $this->featured_image = $data['featured_image'] ?? null; + } + + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * Sets id. + * + * @param string|null $id + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets project_id. + * + * @return string|null + */ + public function getProjectId(): ?string + { + return $this->project_id; + } + + /** + * Sets project_id. + * + * @param string|null $project_id + * + * @return $this + */ + public function setProjectId(string $project_id = null): self + { + $this->project_id = $project_id; + + return $this; + } + + /** + * Gets project_url. + * + * @return string|null + */ + public function getProjectUrl(): ?string + { + return $this->project_url; + } + + /** + * Sets project_url. + * + * @param string|null $project_url + * + * @return $this + */ + public function setProjectUrl(string $project_url = null): self + { + $this->project_url = $project_url; + + return $this; + } + + /** + * Gets url. + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->url; + } + + /** + * Sets url. + * + * @param string|null $url + * + * @return $this + */ + public function setUrl(string $url = null): self + { + $this->url = $url; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets author. + * + * @return string|null + */ + public function getAuthor(): ?string + { + return $this->author; + } + + /** + * Sets author. + * + * @param string|null $author + * + * @return $this + */ + public function setAuthor(string $author = null): self + { + $this->author = $author; + + return $this; + } + + /** + * Gets featured_image. + * + * @return string|null + */ + public function getFeaturedImage(): ?string + { + return $this->featured_image; + } + + /** + * Sets featured_image. + * + * @param string|null $featured_image + * + * @return $this + */ + public function setFeaturedImage(string $featured_image = null): self + { + $this->featured_image = $featured_image; + + return $this; + } } + + diff --git a/Model/JWTResponse.php b/Model/JWTResponse.php index 9579b9c6..cf37a689 100644 --- a/Model/JWTResponse.php +++ b/Model/JWTResponse.php @@ -1,24 +1,24 @@ token = $data['token'] ?? null; - $this->refresh_token = $data['refresh_token'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->token = $data['token'] ?? null; + $this->refresh_token = $data['refresh_token'] ?? null; + } - /** - * Gets token. - */ - public function getToken(): ?string - { - return $this->token; - } + /** + * Gets token. + * + * @return string|null + */ + public function getToken(): ?string + { + return $this->token; + } - /** - * Sets token. - * - * @return $this - */ - public function setToken(string $token = null): self - { - $this->token = $token; + /** + * Sets token. + * + * @param string|null $token + * + * @return $this + */ + public function setToken(string $token = null): self + { + $this->token = $token; - return $this; - } + return $this; + } - /** - * Gets refresh_token. - */ - public function getRefreshToken(): ?string - { - return $this->refresh_token; - } + /** + * Gets refresh_token. + * + * @return string|null + */ + public function getRefreshToken(): ?string + { + return $this->refresh_token; + } - /** - * Sets refresh_token. - * - * @return $this - */ - public function setRefreshToken(string $refresh_token = null): self - { - $this->refresh_token = $refresh_token; + /** + * Sets refresh_token. + * + * @param string|null $refresh_token + * + * @return $this + */ + public function setRefreshToken(string $refresh_token = null): self + { + $this->refresh_token = $refresh_token; - return $this; - } + return $this; + } } + + diff --git a/Model/LoginRequest.php b/Model/LoginRequest.php index 664d0ec2..407577b3 100644 --- a/Model/LoginRequest.php +++ b/Model/LoginRequest.php @@ -1,24 +1,24 @@ username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + } - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } - /** - * Sets username. - * - * @param string|null $username Name of the user - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; + /** + * Sets username. + * + * @param string|null $username Name of the user + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; - return $this; - } + return $this; + } - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } - /** - * Sets password. - * - * @param string|null $password A secure password - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; + /** + * Sets password. + * + * @param string|null $password A secure password + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; - return $this; - } + return $this; + } } + + diff --git a/Model/MediaCategoryResponse.php b/Model/MediaCategoryResponse.php index c0ae9ebe..0ceb638f 100644 --- a/Model/MediaCategoryResponse.php +++ b/Model/MediaCategoryResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->name = $data['name'] ?? null; - $this->priority = $data['priority'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?int - { - return $this->id; - } - - /** - * Sets id. - * - * @param int|null $id ID of the category - * - * @return $this - */ - public function setId(int $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @param string|null $name Name of the category - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets priority. - */ - public function getPriority(): ?int - { - return $this->priority; - } - - /** - * Sets priority. - * - * @param int|null $priority Shows how important a category is (0 is the least priority) - * - * @return $this - */ - public function setPriority(int $priority = null): self - { - $this->priority = $priority; - - return $this; - } + /** + * ID of the category + * + * @var int|null + * @SerializedName("id") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $id; + + /** + * Name of the category + * + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * Shows how important a category is (0 is the least priority) + * + * @var int|null + * @SerializedName("priority") + * @Assert\Type("int") + * @Type("int") + * @Assert\GreaterThanOrEqual(0) + */ + protected ?int $priority; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->name = $data['name'] ?? null; + $this->priority = $data['priority'] ?? null; + } + + /** + * Gets id. + * + * @return int|null + */ + public function getId(): ?int + { + return $this->id; + } + + /** + * Sets id. + * + * @param int|null $id ID of the category + * + * @return $this + */ + public function setId(int $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name Name of the category + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets priority. + * + * @return int|null + */ + public function getPriority(): ?int + { + return $this->priority; + } + + /** + * Sets priority. + * + * @param int|null $priority Shows how important a category is (0 is the least priority) + * + * @return $this + */ + public function setPriority(int $priority = null): self + { + $this->priority = $priority; + + return $this; + } } + + diff --git a/Model/MediaFileResponse.php b/Model/MediaFileResponse.php index a334948d..06093009 100644 --- a/Model/MediaFileResponse.php +++ b/Model/MediaFileResponse.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $flavors; - - /** - * @var string[]|null - * @SerializedName("packages") - * @Assert\All({ - * @Assert\Type("string") - * }) - * @Type("array") - */ - protected ?array $packages; - - /** - * @SerializedName("category") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $category; - - /** - * @SerializedName("author") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $author; - - /** - * @SerializedName("extension") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $extension; - - /** - * @SerializedName("download_url") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $download_url; - - /** - * Size of the file in bytes. - * - * @SerializedName("size") - * @Assert\Type("int") - * @Type("int") - */ - protected ?int $size; - - /** - * Type of the media file. - * - * @SerializedName("file_type") - * @Assert\Choice({ "project", "image", "sound", "video", "other" }) - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $file_type; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->id = $data['id'] ?? null; - $this->name = $data['name'] ?? null; - $this->flavors = $data['flavors'] ?? null; - $this->packages = $data['packages'] ?? null; - $this->category = $data['category'] ?? null; - $this->author = $data['author'] ?? null; - $this->extension = $data['extension'] ?? null; - $this->download_url = $data['download_url'] ?? null; - $this->size = $data['size'] ?? null; - $this->file_type = $data['file_type'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?int - { - return $this->id; - } - - /** - * Sets id. - * - * @return $this - */ - public function setId(int $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets flavors. - * - * @return string[]|null - */ - public function getFlavors(): ?array - { - return $this->flavors; - } - - /** - * Sets flavors. - * - * @param string[]|null $flavors - * - * @return $this - */ - public function setFlavors(array $flavors = null): self - { - $this->flavors = $flavors; - - return $this; - } - - /** - * Gets packages. - * - * @return string[]|null - */ - public function getPackages(): ?array - { - return $this->packages; - } - - /** - * Sets packages. - * - * @param string[]|null $packages - * - * @return $this - */ - public function setPackages(array $packages = null): self - { - $this->packages = $packages; - - return $this; - } - - /** - * Gets category. - */ - public function getCategory(): ?string - { - return $this->category; - } - - /** - * Sets category. - * - * @return $this - */ - public function setCategory(string $category = null): self - { - $this->category = $category; - - return $this; - } - - /** - * Gets author. - */ - public function getAuthor(): ?string - { - return $this->author; - } - - /** - * Sets author. - * - * @return $this - */ - public function setAuthor(string $author = null): self - { - $this->author = $author; - - return $this; - } - - /** - * Gets extension. - */ - public function getExtension(): ?string - { - return $this->extension; - } - - /** - * Sets extension. - * - * @return $this - */ - public function setExtension(string $extension = null): self - { - $this->extension = $extension; - - return $this; - } - - /** - * Gets download_url. - */ - public function getDownloadUrl(): ?string - { - return $this->download_url; - } - - /** - * Sets download_url. - * - * @return $this - */ - public function setDownloadUrl(string $download_url = null): self - { - $this->download_url = $download_url; - - return $this; - } - - /** - * Gets size. - */ - public function getSize(): ?int - { - return $this->size; - } - - /** - * Sets size. - * - * @param int|null $size Size of the file in bytes - * - * @return $this - */ - public function setSize(int $size = null): self - { - $this->size = $size; - - return $this; - } - - /** - * Gets file_type. - */ - public function getFileType(): ?string - { - return $this->file_type; - } - - /** - * Sets file_type. - * - * @param string|null $file_type Type of the media file - * - * @return $this - */ - public function setFileType(string $file_type = null): self - { - $this->file_type = $file_type; - - return $this; - } + /** + * @var int|null + * @SerializedName("id") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $id; + + /** + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * @var string[]|null + * @SerializedName("flavors") + * @Assert\All({ + * @Assert\Type("string") + * }) + * @Type("array") + */ + protected ?array $flavors; + + /** + * @var string[]|null + * @SerializedName("packages") + * @Assert\All({ + * @Assert\Type("string") + * }) + * @Type("array") + */ + protected ?array $packages; + + /** + * @var string|null + * @SerializedName("category") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $category; + + /** + * @var string|null + * @SerializedName("author") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $author; + + /** + * @var string|null + * @SerializedName("extension") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $extension; + + /** + * @var string|null + * @SerializedName("download_url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $download_url; + + /** + * Size of the file in bytes + * + * @var int|null + * @SerializedName("size") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $size; + + /** + * Type of the media file + * + * @var string|null + * @SerializedName("file_type") + * @Assert\Choice({ "project", "image", "sound", "video", "other" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $file_type; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->name = $data['name'] ?? null; + $this->flavors = $data['flavors'] ?? null; + $this->packages = $data['packages'] ?? null; + $this->category = $data['category'] ?? null; + $this->author = $data['author'] ?? null; + $this->extension = $data['extension'] ?? null; + $this->download_url = $data['download_url'] ?? null; + $this->size = $data['size'] ?? null; + $this->file_type = $data['file_type'] ?? null; + } + + /** + * Gets id. + * + * @return int|null + */ + public function getId(): ?int + { + return $this->id; + } + + /** + * Sets id. + * + * @param int|null $id + * + * @return $this + */ + public function setId(int $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets flavors. + * + * @return string[]|null + */ + public function getFlavors(): ?array + { + return $this->flavors; + } + + /** + * Sets flavors. + * + * @param string[]|null $flavors + * + * @return $this + */ + public function setFlavors(array $flavors = null): self + { + $this->flavors = $flavors; + + return $this; + } + + /** + * Gets packages. + * + * @return string[]|null + */ + public function getPackages(): ?array + { + return $this->packages; + } + + /** + * Sets packages. + * + * @param string[]|null $packages + * + * @return $this + */ + public function setPackages(array $packages = null): self + { + $this->packages = $packages; + + return $this; + } + + /** + * Gets category. + * + * @return string|null + */ + public function getCategory(): ?string + { + return $this->category; + } + + /** + * Sets category. + * + * @param string|null $category + * + * @return $this + */ + public function setCategory(string $category = null): self + { + $this->category = $category; + + return $this; + } + + /** + * Gets author. + * + * @return string|null + */ + public function getAuthor(): ?string + { + return $this->author; + } + + /** + * Sets author. + * + * @param string|null $author + * + * @return $this + */ + public function setAuthor(string $author = null): self + { + $this->author = $author; + + return $this; + } + + /** + * Gets extension. + * + * @return string|null + */ + public function getExtension(): ?string + { + return $this->extension; + } + + /** + * Sets extension. + * + * @param string|null $extension + * + * @return $this + */ + public function setExtension(string $extension = null): self + { + $this->extension = $extension; + + return $this; + } + + /** + * Gets download_url. + * + * @return string|null + */ + public function getDownloadUrl(): ?string + { + return $this->download_url; + } + + /** + * Sets download_url. + * + * @param string|null $download_url + * + * @return $this + */ + public function setDownloadUrl(string $download_url = null): self + { + $this->download_url = $download_url; + + return $this; + } + + /** + * Gets size. + * + * @return int|null + */ + public function getSize(): ?int + { + return $this->size; + } + + /** + * Sets size. + * + * @param int|null $size Size of the file in bytes + * + * @return $this + */ + public function setSize(int $size = null): self + { + $this->size = $size; + + return $this; + } + + /** + * Gets file_type. + * + * @return string|null + */ + public function getFileType(): ?string + { + return $this->file_type; + } + + /** + * Sets file_type. + * + * @param string|null $file_type Type of the media file + * + * @return $this + */ + public function setFileType(string $file_type = null): self + { + $this->file_type = $file_type; + + return $this; + } } + + diff --git a/Model/MediaPackageResponse.php b/Model/MediaPackageResponse.php index 8672d5ea..15d29cc7 100644 --- a/Model/MediaPackageResponse.php +++ b/Model/MediaPackageResponse.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $categories; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->id = $data['id'] ?? null; - $this->name = $data['name'] ?? null; - $this->url = $data['url'] ?? null; - $this->categories = $data['categories'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?int - { - return $this->id; - } - - /** - * Sets id. - * - * @param int|null $id ID of the package - * - * @return $this - */ - public function setId(int $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @param string|null $name Name of the package - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets url. - */ - public function getUrl(): ?string - { - return $this->url; - } - - /** - * Sets url. - * - * @param string|null $url Absolute path to the package - * - * @return $this - */ - public function setUrl(string $url = null): self - { - $this->url = $url; - - return $this; - } - - /** - * Gets categories. - * - * @return array[]|null - */ - public function getCategories(): ?array - { - return $this->categories; - } - - /** - * Sets categories. - * - * @param array[]|null $categories - * - * @return $this - */ - public function setCategories(array $categories = null): self - { - $this->categories = $categories; - - return $this; - } + /** + * ID of the package + * + * @var int|null + * @SerializedName("id") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $id; + + /** + * Name of the package + * + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * Absolute path to the package + * + * @var string|null + * @SerializedName("url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $url; + + /** + * @var array[]|null + * @SerializedName("categories") + * @Assert\All({ + * @Assert\Type("OpenAPI\Server\Model\MediaCategoryResponse") + * }) + * @Type("array") + */ + protected ?array $categories; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->name = $data['name'] ?? null; + $this->url = $data['url'] ?? null; + $this->categories = $data['categories'] ?? null; + } + + /** + * Gets id. + * + * @return int|null + */ + public function getId(): ?int + { + return $this->id; + } + + /** + * Sets id. + * + * @param int|null $id ID of the package + * + * @return $this + */ + public function setId(int $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name Name of the package + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets url. + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->url; + } + + /** + * Sets url. + * + * @param string|null $url Absolute path to the package + * + * @return $this + */ + public function setUrl(string $url = null): self + { + $this->url = $url; + + return $this; + } + + /** + * Gets categories. + * + * @return array[]|null + */ + public function getCategories(): ?array + { + return $this->categories; + } + + /** + * Sets categories. + * + * @param array[]|null $categories + * + * @return $this + */ + public function setCategories(array $categories = null): self + { + $this->categories = $categories; + + return $this; + } } + + diff --git a/Model/NotificationContent.php b/Model/NotificationContent.php index 2eaed13a..32311792 100644 --- a/Model/NotificationContent.php +++ b/Model/NotificationContent.php @@ -1,24 +1,24 @@ from = $data['from'] ?? null; - $this->from_name = $data['from_name'] ?? null; - $this->program = $data['program'] ?? null; - $this->program_name = $data['program_name'] ?? null; - $this->avatar = $data['avatar'] ?? null; - $this->remixed_program = $data['remixed_program'] ?? null; - $this->remixed_program_name = $data['remixed_program_name'] ?? null; - $this->message = $data['message'] ?? null; - $this->prize = $data['prize'] ?? null; - } - - /** - * Gets from. - */ - public function getFrom(): ?string - { - return $this->from; - } - - /** - * Sets from. - * - * @param string|null $from Id of the user who caused the notification - * - * @return $this - */ - public function setFrom(string $from = null): self - { - $this->from = $from; - - return $this; - } - - /** - * Gets from_name. - */ - public function getFromName(): ?string - { - return $this->from_name; - } - - /** - * Sets from_name. - * - * @param string|null $from_name Username of the user who caused the notification - * - * @return $this - */ - public function setFromName(string $from_name = null): self - { - $this->from_name = $from_name; - - return $this; - } - - /** - * Gets program. - */ - public function getProgram(): ?string - { - return $this->program; - } - - /** - * Sets program. - * - * @param string|null $program Id of the program for which the notification is about - * - * @return $this - */ - public function setProgram(string $program = null): self - { - $this->program = $program; - - return $this; - } - - /** - * Gets program_name. - */ - public function getProgramName(): ?string - { - return $this->program_name; - } - - /** - * Sets program_name. - * - * @param string|null $program_name Name of the program for which the notification is about - * - * @return $this - */ - public function setProgramName(string $program_name = null): self - { - $this->program_name = $program_name; - - return $this; - } - - /** - * Gets avatar. - */ - public function getAvatar(): ?string - { - return $this->avatar; - } - - /** - * Sets avatar. - * - * @param string|null $avatar Avatar of the user who caused the notification - * - * @return $this - */ - public function setAvatar(string $avatar = null): self - { - $this->avatar = $avatar; - - return $this; - } - - /** - * Gets remixed_program. - */ - public function getRemixedProgram(): ?string - { - return $this->remixed_program; - } - - /** - * Sets remixed_program. - * - * @param string|null $remixed_program Id of the remixed program - * - * @return $this - */ - public function setRemixedProgram(string $remixed_program = null): self - { - $this->remixed_program = $remixed_program; - - return $this; - } - - /** - * Gets remixed_program_name. - */ - public function getRemixedProgramName(): ?string - { - return $this->remixed_program_name; - } - - /** - * Sets remixed_program_name. - * - * @param string|null $remixed_program_name Name of the remixed program - * - * @return $this - */ - public function setRemixedProgramName(string $remixed_program_name = null): self - { - $this->remixed_program_name = $remixed_program_name; - - return $this; - } - - /** - * Gets message. - */ - public function getMessage(): ?string - { - return $this->message; - } - - /** - * Sets message. - * - * @param string|null $message Notification message - * - * @return $this - */ - public function setMessage(string $message = null): self - { - $this->message = $message; - - return $this; - } - - /** - * Gets prize. - */ - public function getPrize(): ?string - { - return $this->prize; - } - - /** - * Sets prize. - * - * @param string|null $prize Prize for anniversary notifications - * - * @return $this - */ - public function setPrize(string $prize = null): self - { - $this->prize = $prize; - - return $this; - } + /** + * Id of the user who caused the notification + * + * @var string|null + * @SerializedName("from") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $from; + + /** + * Username of the user who caused the notification + * + * @var string|null + * @SerializedName("from_name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $from_name; + + /** + * Id of the program for which the notification is about + * + * @var string|null + * @SerializedName("program") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $program; + + /** + * Name of the program for which the notification is about + * + * @var string|null + * @SerializedName("program_name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $program_name; + + /** + * Avatar of the user who caused the notification + * + * @var string|null + * @SerializedName("avatar") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $avatar; + + /** + * Id of the remixed program + * + * @var string|null + * @SerializedName("remixed_program") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $remixed_program; + + /** + * Name of the remixed program + * + * @var string|null + * @SerializedName("remixed_program_name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $remixed_program_name; + + /** + * Notification message + * + * @var string|null + * @SerializedName("message") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $message; + + /** + * Prize for anniversary notifications + * + * @var string|null + * @SerializedName("prize") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $prize; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->from = $data['from'] ?? null; + $this->from_name = $data['from_name'] ?? null; + $this->program = $data['program'] ?? null; + $this->program_name = $data['program_name'] ?? null; + $this->avatar = $data['avatar'] ?? null; + $this->remixed_program = $data['remixed_program'] ?? null; + $this->remixed_program_name = $data['remixed_program_name'] ?? null; + $this->message = $data['message'] ?? null; + $this->prize = $data['prize'] ?? null; + } + + /** + * Gets from. + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->from; + } + + /** + * Sets from. + * + * @param string|null $from Id of the user who caused the notification + * + * @return $this + */ + public function setFrom(string $from = null): self + { + $this->from = $from; + + return $this; + } + + /** + * Gets from_name. + * + * @return string|null + */ + public function getFromName(): ?string + { + return $this->from_name; + } + + /** + * Sets from_name. + * + * @param string|null $from_name Username of the user who caused the notification + * + * @return $this + */ + public function setFromName(string $from_name = null): self + { + $this->from_name = $from_name; + + return $this; + } + + /** + * Gets program. + * + * @return string|null + */ + public function getProgram(): ?string + { + return $this->program; + } + + /** + * Sets program. + * + * @param string|null $program Id of the program for which the notification is about + * + * @return $this + */ + public function setProgram(string $program = null): self + { + $this->program = $program; + + return $this; + } + + /** + * Gets program_name. + * + * @return string|null + */ + public function getProgramName(): ?string + { + return $this->program_name; + } + + /** + * Sets program_name. + * + * @param string|null $program_name Name of the program for which the notification is about + * + * @return $this + */ + public function setProgramName(string $program_name = null): self + { + $this->program_name = $program_name; + + return $this; + } + + /** + * Gets avatar. + * + * @return string|null + */ + public function getAvatar(): ?string + { + return $this->avatar; + } + + /** + * Sets avatar. + * + * @param string|null $avatar Avatar of the user who caused the notification + * + * @return $this + */ + public function setAvatar(string $avatar = null): self + { + $this->avatar = $avatar; + + return $this; + } + + /** + * Gets remixed_program. + * + * @return string|null + */ + public function getRemixedProgram(): ?string + { + return $this->remixed_program; + } + + /** + * Sets remixed_program. + * + * @param string|null $remixed_program Id of the remixed program + * + * @return $this + */ + public function setRemixedProgram(string $remixed_program = null): self + { + $this->remixed_program = $remixed_program; + + return $this; + } + + /** + * Gets remixed_program_name. + * + * @return string|null + */ + public function getRemixedProgramName(): ?string + { + return $this->remixed_program_name; + } + + /** + * Sets remixed_program_name. + * + * @param string|null $remixed_program_name Name of the remixed program + * + * @return $this + */ + public function setRemixedProgramName(string $remixed_program_name = null): self + { + $this->remixed_program_name = $remixed_program_name; + + return $this; + } + + /** + * Gets message. + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->message; + } + + /** + * Sets message. + * + * @param string|null $message Notification message + * + * @return $this + */ + public function setMessage(string $message = null): self + { + $this->message = $message; + + return $this; + } + + /** + * Gets prize. + * + * @return string|null + */ + public function getPrize(): ?string + { + return $this->prize; + } + + /** + * Sets prize. + * + * @param string|null $prize Prize for anniversary notifications + * + * @return $this + */ + public function setPrize(string $prize = null): self + { + $this->prize = $prize; + + return $this; + } } + + diff --git a/Model/NotificationResponse.php b/Model/NotificationResponse.php index 70871c75..4fd742ba 100644 --- a/Model/NotificationResponse.php +++ b/Model/NotificationResponse.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $content; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->id = $data['id'] ?? null; - $this->type = $data['type'] ?? null; - $this->seen = $data['seen'] ?? null; - $this->content = $data['content'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?int - { - return $this->id; - } - - /** - * Sets id. - * - * @param int|null $id Id of the notification - * - * @return $this - */ - public function setId(int $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets type. - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * Sets type. - * - * @param string|null $type Notification Type - * - * @return $this - */ - public function setType(string $type = null): self - { - $this->type = $type; - - return $this; - } - - /** - * Gets seen. - */ - public function isSeen(): ?bool - { - return $this->seen; - } - - /** - * Sets seen. - * - * @param bool|null $seen Seen status of the notification - * - * @return $this - */ - public function setSeen(bool $seen = null): self - { - $this->seen = $seen; - - return $this; - } - - /** - * Gets content. - * - * @return \OpenAPI\Server\Model\NotificationContent[]|null - */ - public function getContent(): ?array - { - return $this->content; - } - - /** - * Sets content. - * - * @param \OpenAPI\Server\Model\NotificationContent[]|null $content - * - * @return $this - */ - public function setContent(array $content = null): self - { - $this->content = $content; - - return $this; - } + /** + * Id of the notification + * + * @var int|null + * @SerializedName("id") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $id; + + /** + * Notification Type + * + * @var string|null + * @SerializedName("type") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $type; + + /** + * Seen status of the notification + * + * @var bool|null + * @SerializedName("seen") + * @Assert\Type("bool") + * @Type("bool") + */ + protected ?bool $seen; + + /** + * @var \OpenAPI\Server\Model\NotificationContent[]|null + * @SerializedName("content") + * @Assert\All({ + * @Assert\Type("OpenAPI\Server\Model\NotificationContent") + * }) + * @Type("array") + */ + protected ?array $content; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->type = $data['type'] ?? null; + $this->seen = $data['seen'] ?? null; + $this->content = $data['content'] ?? null; + } + + /** + * Gets id. + * + * @return int|null + */ + public function getId(): ?int + { + return $this->id; + } + + /** + * Sets id. + * + * @param int|null $id Id of the notification + * + * @return $this + */ + public function setId(int $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets type. + * + * @return string|null + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets type. + * + * @param string|null $type Notification Type + * + * @return $this + */ + public function setType(string $type = null): self + { + $this->type = $type; + + return $this; + } + + /** + * Gets seen. + * + * @return bool|null + */ + public function isSeen(): ?bool + { + return $this->seen; + } + + /** + * Sets seen. + * + * @param bool|null $seen Seen status of the notification + * + * @return $this + */ + public function setSeen(bool $seen = null): self + { + $this->seen = $seen; + + return $this; + } + + /** + * Gets content. + * + * @return \OpenAPI\Server\Model\NotificationContent[]|null + */ + public function getContent(): ?array + { + return $this->content; + } + + /** + * Sets content. + * + * @param \OpenAPI\Server\Model\NotificationContent[]|null $content + * + * @return $this + */ + public function setContent(array $content = null): self + { + $this->content = $content; + + return $this; + } } + + diff --git a/Model/NotificationsCountResponse.php b/Model/NotificationsCountResponse.php index b6fb4395..f32b9e2c 100644 --- a/Model/NotificationsCountResponse.php +++ b/Model/NotificationsCountResponse.php @@ -1,24 +1,24 @@ total = $data['total'] ?? null; - $this->like = $data['like'] ?? null; - $this->follower = $data['follower'] ?? null; - $this->comment = $data['comment'] ?? null; - $this->remix = $data['remix'] ?? null; - } - - /** - * Gets total. - */ - public function getTotal(): ?int - { - return $this->total; - } - - /** - * Sets total. - * - * @return $this - */ - public function setTotal(int $total = null): self - { - $this->total = $total; - - return $this; - } - - /** - * Gets like. - */ - public function getLike(): ?int - { - return $this->like; - } - - /** - * Sets like. - * - * @return $this - */ - public function setLike(int $like = null): self - { - $this->like = $like; - - return $this; - } - - /** - * Gets follower. - */ - public function getFollower(): ?int - { - return $this->follower; - } - - /** - * Sets follower. - * - * @return $this - */ - public function setFollower(int $follower = null): self - { - $this->follower = $follower; - - return $this; - } - - /** - * Gets comment. - */ - public function getComment(): ?int - { - return $this->comment; - } - - /** - * Sets comment. - * - * @return $this - */ - public function setComment(int $comment = null): self - { - $this->comment = $comment; - - return $this; - } - - /** - * Gets remix. - */ - public function getRemix(): ?int - { - return $this->remix; - } - - /** - * Sets remix. - * - * @return $this - */ - public function setRemix(int $remix = null): self - { - $this->remix = $remix; - - return $this; - } + /** + * @var int|null + * @SerializedName("total") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $total; + + /** + * @var int|null + * @SerializedName("like") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $like; + + /** + * @var int|null + * @SerializedName("follower") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $follower; + + /** + * @var int|null + * @SerializedName("comment") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $comment; + + /** + * @var int|null + * @SerializedName("remix") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $remix; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->total = $data['total'] ?? null; + $this->like = $data['like'] ?? null; + $this->follower = $data['follower'] ?? null; + $this->comment = $data['comment'] ?? null; + $this->remix = $data['remix'] ?? null; + } + + /** + * Gets total. + * + * @return int|null + */ + public function getTotal(): ?int + { + return $this->total; + } + + /** + * Sets total. + * + * @param int|null $total + * + * @return $this + */ + public function setTotal(int $total = null): self + { + $this->total = $total; + + return $this; + } + + /** + * Gets like. + * + * @return int|null + */ + public function getLike(): ?int + { + return $this->like; + } + + /** + * Sets like. + * + * @param int|null $like + * + * @return $this + */ + public function setLike(int $like = null): self + { + $this->like = $like; + + return $this; + } + + /** + * Gets follower. + * + * @return int|null + */ + public function getFollower(): ?int + { + return $this->follower; + } + + /** + * Sets follower. + * + * @param int|null $follower + * + * @return $this + */ + public function setFollower(int $follower = null): self + { + $this->follower = $follower; + + return $this; + } + + /** + * Gets comment. + * + * @return int|null + */ + public function getComment(): ?int + { + return $this->comment; + } + + /** + * Sets comment. + * + * @param int|null $comment + * + * @return $this + */ + public function setComment(int $comment = null): self + { + $this->comment = $comment; + + return $this; + } + + /** + * Gets remix. + * + * @return int|null + */ + public function getRemix(): ?int + { + return $this->remix; + } + + /** + * Sets remix. + * + * @param int|null $remix + * + * @return $this + */ + public function setRemix(int $remix = null): self + { + $this->remix = $remix; + + return $this; + } } + + diff --git a/Model/OAuthLoginRequest.php b/Model/OAuthLoginRequest.php index e000aeaf..276708b7 100644 --- a/Model/OAuthLoginRequest.php +++ b/Model/OAuthLoginRequest.php @@ -1,24 +1,24 @@ id_token = $data['id_token'] ?? null; - $this->resource_owner = $data['resource_owner'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id_token = $data['id_token'] ?? null; + $this->resource_owner = $data['resource_owner'] ?? null; + } - /** - * Gets id_token. - */ - public function getIdToken(): ?string - { - return $this->id_token; - } + /** + * Gets id_token. + * + * @return string|null + */ + public function getIdToken(): ?string + { + return $this->id_token; + } - /** - * Sets id_token. - * - * @param string|null $id_token User ID token - * - * @return $this - */ - public function setIdToken(string $id_token = null): self - { - $this->id_token = $id_token; + /** + * Sets id_token. + * + * @param string|null $id_token User ID token + * + * @return $this + */ + public function setIdToken(string $id_token = null): self + { + $this->id_token = $id_token; - return $this; - } + return $this; + } - /** - * Gets resource_owner. - */ - public function getResourceOwner(): ?string - { - return $this->resource_owner; - } + /** + * Gets resource_owner. + * + * @return string|null + */ + public function getResourceOwner(): ?string + { + return $this->resource_owner; + } - /** - * Sets resource_owner. - * - * @param string|null $resource_owner OAuth provider - * - * @return $this - */ - public function setResourceOwner(string $resource_owner = null): self - { - $this->resource_owner = $resource_owner; + /** + * Sets resource_owner. + * + * @param string|null $resource_owner OAuth provider + * + * @return $this + */ + public function setResourceOwner(string $resource_owner = null): self + { + $this->resource_owner = $resource_owner; - return $this; - } + return $this; + } } + + diff --git a/Model/ProjectReportRequest.php b/Model/ProjectReportRequest.php index 5b57e3b5..066c3b58 100644 --- a/Model/ProjectReportRequest.php +++ b/Model/ProjectReportRequest.php @@ -1,24 +1,24 @@ category = $data['category'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->category = $data['category'] ?? null; + } - /** - * Gets category. - */ - public function getCategory(): ?string - { - return $this->category; - } + /** + * Gets category. + * + * @return string|null + */ + public function getCategory(): ?string + { + return $this->category; + } - /** - * Sets category. - * - * @return $this - */ - public function setCategory(string $category = null): self - { - $this->category = $category; + /** + * Sets category. + * + * @param string|null $category + * + * @return $this + */ + public function setCategory(string $category = null): self + { + $this->category = $category; - return $this; - } + return $this; + } } + + diff --git a/Model/ProjectResponse.php b/Model/ProjectResponse.php index 74defdc1..adc781bf 100644 --- a/Model/ProjectResponse.php +++ b/Model/ProjectResponse.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $tags; - - /** - * @SerializedName("uploaded") - * @Assert\Type("int") - * @Type("int") - */ - protected ?int $uploaded; - - /** - * @SerializedName("uploaded_string") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $uploaded_string; - - /** - * @SerializedName("screenshot_large") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $screenshot_large; - - /** - * @SerializedName("screenshot_small") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $screenshot_small; - - /** - * @SerializedName("project_url") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $project_url; - - /** - * @SerializedName("download_url") - * @Assert\Type("string") - * @Type("string") - */ - protected ?string $download_url; - - /** - * filesize in megabytes. - * - * @SerializedName("filesize") - * @Assert\Type("float") - * @Type("float") - */ - protected ?float $filesize; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->id = $data['id'] ?? null; - $this->name = $data['name'] ?? null; - $this->author = $data['author'] ?? null; - $this->description = $data['description'] ?? null; - $this->version = $data['version'] ?? null; - $this->views = $data['views'] ?? null; - $this->downloads = $data['downloads'] ?? null; - $this->reactions = $data['reactions'] ?? null; - $this->comments = $data['comments'] ?? null; - $this->private = $data['private'] ?? null; - $this->flavor = $data['flavor'] ?? null; - $this->tags = $data['tags'] ?? null; - $this->uploaded = $data['uploaded'] ?? null; - $this->uploaded_string = $data['uploaded_string'] ?? null; - $this->screenshot_large = $data['screenshot_large'] ?? null; - $this->screenshot_small = $data['screenshot_small'] ?? null; - $this->project_url = $data['project_url'] ?? null; - $this->download_url = $data['download_url'] ?? null; - $this->filesize = $data['filesize'] ?? null; - } - - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } - - /** - * Sets id. - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets author. - */ - public function getAuthor(): ?string - { - return $this->author; - } - - /** - * Sets author. - * - * @return $this - */ - public function setAuthor(string $author = null): self - { - $this->author = $author; - - return $this; - } - - /** - * Gets description. - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * Sets description. - * - * @return $this - */ - public function setDescription(string $description = null): self - { - $this->description = $description; - - return $this; - } - - /** - * Gets version. - */ - public function getVersion(): ?string - { - return $this->version; - } - - /** - * Sets version. - * - * @return $this - */ - public function setVersion(string $version = null): self - { - $this->version = $version; - - return $this; - } - - /** - * Gets views. - */ - public function getViews(): ?int - { - return $this->views; - } - - /** - * Sets views. - * - * @return $this - */ - public function setViews(int $views = null): self - { - $this->views = $views; - - return $this; - } - - /** - * Gets downloads. - */ - public function getDownloads(): ?int - { - return $this->downloads; - } - - /** - * Sets downloads. - * - * @return $this - */ - public function setDownloads(int $downloads = null): self - { - $this->downloads = $downloads; - - return $this; - } - - /** - * Gets reactions. - */ - public function getReactions(): ?int - { - return $this->reactions; - } - - /** - * Sets reactions. - * - * @return $this - */ - public function setReactions(int $reactions = null): self - { - $this->reactions = $reactions; - - return $this; - } - - /** - * Gets comments. - */ - public function getComments(): ?int - { - return $this->comments; - } - - /** - * Sets comments. - * - * @return $this - */ - public function setComments(int $comments = null): self - { - $this->comments = $comments; - - return $this; - } - - /** - * Gets private. - */ - public function isPrivate(): ?bool - { - return $this->private; - } - - /** - * Sets private. - * - * @return $this - */ - public function setPrivate(bool $private = null): self - { - $this->private = $private; - - return $this; - } - - /** - * Gets flavor. - */ - public function getFlavor(): ?string - { - return $this->flavor; - } - - /** - * Sets flavor. - * - * @return $this - */ - public function setFlavor(string $flavor = null): self - { - $this->flavor = $flavor; - - return $this; - } - - /** - * Gets tags. - * - * @return string[]|null - */ - public function getTags(): ?array - { - return $this->tags; - } - - /** - * Sets tags. - * - * @param string[]|null $tags - * - * @return $this - */ - public function setTags(array $tags = null): self - { - $this->tags = $tags; - - return $this; - } - - /** - * Gets uploaded. - */ - public function getUploaded(): ?int - { - return $this->uploaded; - } - - /** - * Sets uploaded. - * - * @return $this - */ - public function setUploaded(int $uploaded = null): self - { - $this->uploaded = $uploaded; - - return $this; - } - - /** - * Gets uploaded_string. - */ - public function getUploadedString(): ?string - { - return $this->uploaded_string; - } - - /** - * Sets uploaded_string. - * - * @return $this - */ - public function setUploadedString(string $uploaded_string = null): self - { - $this->uploaded_string = $uploaded_string; - - return $this; - } - - /** - * Gets screenshot_large. - */ - public function getScreenshotLarge(): ?string - { - return $this->screenshot_large; - } - - /** - * Sets screenshot_large. - * - * @return $this - */ - public function setScreenshotLarge(string $screenshot_large = null): self - { - $this->screenshot_large = $screenshot_large; - - return $this; - } - - /** - * Gets screenshot_small. - */ - public function getScreenshotSmall(): ?string - { - return $this->screenshot_small; - } - - /** - * Sets screenshot_small. - * - * @return $this - */ - public function setScreenshotSmall(string $screenshot_small = null): self - { - $this->screenshot_small = $screenshot_small; - - return $this; - } - - /** - * Gets project_url. - */ - public function getProjectUrl(): ?string - { - return $this->project_url; - } - - /** - * Sets project_url. - * - * @return $this - */ - public function setProjectUrl(string $project_url = null): self - { - $this->project_url = $project_url; - - return $this; - } - - /** - * Gets download_url. - */ - public function getDownloadUrl(): ?string - { - return $this->download_url; - } - - /** - * Sets download_url. - * - * @return $this - */ - public function setDownloadUrl(string $download_url = null): self - { - $this->download_url = $download_url; - - return $this; - } - - /** - * Gets filesize. - */ - public function getFilesize(): ?float - { - return $this->filesize; - } - - /** - * Sets filesize. - * - * @param float|null $filesize filesize in megabytes - * - * @return $this - */ - public function setFilesize(float $filesize = null): self - { - $this->filesize = $filesize; - - return $this; - } + /** + * @var string|null + * @SerializedName("id") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $id; + + /** + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * @var string|null + * @SerializedName("author") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $author; + + /** + * @var string|null + * @SerializedName("description") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $description; + + /** + * @var string|null + * @SerializedName("version") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $version; + + /** + * @var int|null + * @SerializedName("views") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $views; + + /** + * @var int|null + * @SerializedName("downloads") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $downloads; + + /** + * @var int|null + * @SerializedName("reactions") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $reactions; + + /** + * @var int|null + * @SerializedName("comments") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $comments; + + /** + * @var bool|null + * @SerializedName("private") + * @Assert\Type("bool") + * @Type("bool") + */ + protected ?bool $private; + + /** + * @var string|null + * @SerializedName("flavor") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $flavor; + + /** + * @var string[]|null + * @SerializedName("tags") + * @Assert\All({ + * @Assert\Type("string") + * }) + * @Type("array") + */ + protected ?array $tags; + + /** + * @var int|null + * @SerializedName("uploaded") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $uploaded; + + /** + * @var string|null + * @SerializedName("uploaded_string") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $uploaded_string; + + /** + * @var string|null + * @SerializedName("screenshot_large") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $screenshot_large; + + /** + * @var string|null + * @SerializedName("screenshot_small") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $screenshot_small; + + /** + * @var string|null + * @SerializedName("project_url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $project_url; + + /** + * @var string|null + * @SerializedName("download_url") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $download_url; + + /** + * filesize in megabytes + * + * @var float|null + * @SerializedName("filesize") + * @Assert\Type("float") + * @Type("float") + */ + protected ?float $filesize; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->name = $data['name'] ?? null; + $this->author = $data['author'] ?? null; + $this->description = $data['description'] ?? null; + $this->version = $data['version'] ?? null; + $this->views = $data['views'] ?? null; + $this->downloads = $data['downloads'] ?? null; + $this->reactions = $data['reactions'] ?? null; + $this->comments = $data['comments'] ?? null; + $this->private = $data['private'] ?? null; + $this->flavor = $data['flavor'] ?? null; + $this->tags = $data['tags'] ?? null; + $this->uploaded = $data['uploaded'] ?? null; + $this->uploaded_string = $data['uploaded_string'] ?? null; + $this->screenshot_large = $data['screenshot_large'] ?? null; + $this->screenshot_small = $data['screenshot_small'] ?? null; + $this->project_url = $data['project_url'] ?? null; + $this->download_url = $data['download_url'] ?? null; + $this->filesize = $data['filesize'] ?? null; + } + + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * Sets id. + * + * @param string|null $id + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets author. + * + * @return string|null + */ + public function getAuthor(): ?string + { + return $this->author; + } + + /** + * Sets author. + * + * @param string|null $author + * + * @return $this + */ + public function setAuthor(string $author = null): self + { + $this->author = $author; + + return $this; + } + + /** + * Gets description. + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets description. + * + * @param string|null $description + * + * @return $this + */ + public function setDescription(string $description = null): self + { + $this->description = $description; + + return $this; + } + + /** + * Gets version. + * + * @return string|null + */ + public function getVersion(): ?string + { + return $this->version; + } + + /** + * Sets version. + * + * @param string|null $version + * + * @return $this + */ + public function setVersion(string $version = null): self + { + $this->version = $version; + + return $this; + } + + /** + * Gets views. + * + * @return int|null + */ + public function getViews(): ?int + { + return $this->views; + } + + /** + * Sets views. + * + * @param int|null $views + * + * @return $this + */ + public function setViews(int $views = null): self + { + $this->views = $views; + + return $this; + } + + /** + * Gets downloads. + * + * @return int|null + */ + public function getDownloads(): ?int + { + return $this->downloads; + } + + /** + * Sets downloads. + * + * @param int|null $downloads + * + * @return $this + */ + public function setDownloads(int $downloads = null): self + { + $this->downloads = $downloads; + + return $this; + } + + /** + * Gets reactions. + * + * @return int|null + */ + public function getReactions(): ?int + { + return $this->reactions; + } + + /** + * Sets reactions. + * + * @param int|null $reactions + * + * @return $this + */ + public function setReactions(int $reactions = null): self + { + $this->reactions = $reactions; + + return $this; + } + + /** + * Gets comments. + * + * @return int|null + */ + public function getComments(): ?int + { + return $this->comments; + } + + /** + * Sets comments. + * + * @param int|null $comments + * + * @return $this + */ + public function setComments(int $comments = null): self + { + $this->comments = $comments; + + return $this; + } + + /** + * Gets private. + * + * @return bool|null + */ + public function isPrivate(): ?bool + { + return $this->private; + } + + /** + * Sets private. + * + * @param bool|null $private + * + * @return $this + */ + public function setPrivate(bool $private = null): self + { + $this->private = $private; + + return $this; + } + + /** + * Gets flavor. + * + * @return string|null + */ + public function getFlavor(): ?string + { + return $this->flavor; + } + + /** + * Sets flavor. + * + * @param string|null $flavor + * + * @return $this + */ + public function setFlavor(string $flavor = null): self + { + $this->flavor = $flavor; + + return $this; + } + + /** + * Gets tags. + * + * @return string[]|null + */ + public function getTags(): ?array + { + return $this->tags; + } + + /** + * Sets tags. + * + * @param string[]|null $tags + * + * @return $this + */ + public function setTags(array $tags = null): self + { + $this->tags = $tags; + + return $this; + } + + /** + * Gets uploaded. + * + * @return int|null + */ + public function getUploaded(): ?int + { + return $this->uploaded; + } + + /** + * Sets uploaded. + * + * @param int|null $uploaded + * + * @return $this + */ + public function setUploaded(int $uploaded = null): self + { + $this->uploaded = $uploaded; + + return $this; + } + + /** + * Gets uploaded_string. + * + * @return string|null + */ + public function getUploadedString(): ?string + { + return $this->uploaded_string; + } + + /** + * Sets uploaded_string. + * + * @param string|null $uploaded_string + * + * @return $this + */ + public function setUploadedString(string $uploaded_string = null): self + { + $this->uploaded_string = $uploaded_string; + + return $this; + } + + /** + * Gets screenshot_large. + * + * @return string|null + */ + public function getScreenshotLarge(): ?string + { + return $this->screenshot_large; + } + + /** + * Sets screenshot_large. + * + * @param string|null $screenshot_large + * + * @return $this + */ + public function setScreenshotLarge(string $screenshot_large = null): self + { + $this->screenshot_large = $screenshot_large; + + return $this; + } + + /** + * Gets screenshot_small. + * + * @return string|null + */ + public function getScreenshotSmall(): ?string + { + return $this->screenshot_small; + } + + /** + * Sets screenshot_small. + * + * @param string|null $screenshot_small + * + * @return $this + */ + public function setScreenshotSmall(string $screenshot_small = null): self + { + $this->screenshot_small = $screenshot_small; + + return $this; + } + + /** + * Gets project_url. + * + * @return string|null + */ + public function getProjectUrl(): ?string + { + return $this->project_url; + } + + /** + * Sets project_url. + * + * @param string|null $project_url + * + * @return $this + */ + public function setProjectUrl(string $project_url = null): self + { + $this->project_url = $project_url; + + return $this; + } + + /** + * Gets download_url. + * + * @return string|null + */ + public function getDownloadUrl(): ?string + { + return $this->download_url; + } + + /** + * Sets download_url. + * + * @param string|null $download_url + * + * @return $this + */ + public function setDownloadUrl(string $download_url = null): self + { + $this->download_url = $download_url; + + return $this; + } + + /** + * Gets filesize. + * + * @return float|null + */ + public function getFilesize(): ?float + { + return $this->filesize; + } + + /** + * Sets filesize. + * + * @param float|null $filesize filesize in megabytes + * + * @return $this + */ + public function setFilesize(float $filesize = null): self + { + $this->filesize = $filesize; + + return $this; + } } + + diff --git a/Model/ProjectsCategory.php b/Model/ProjectsCategory.php index 44567aa1..ec7d7613 100644 --- a/Model/ProjectsCategory.php +++ b/Model/ProjectsCategory.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $projects_list; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->type = $data['type'] ?? null; - $this->name = $data['name'] ?? null; - $this->projects_list = $data['projects_list'] ?? null; - } - - /** - * Gets type. - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * Sets type. - * - * @param string|null $type the name of the categories in english - * - * @return $this - */ - public function setType(string $type = null): self - { - $this->type = $type; - - return $this; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @param string|null $name Translated name according to the language header - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets projects_list. - * - * @return \OpenAPI\Server\Model\ProjectResponse[]|null - */ - public function getProjectsList(): ?array - { - return $this->projects_list; - } - - /** - * Sets projects_list. - * - * @param \OpenAPI\Server\Model\ProjectResponse[]|null $projects_list Array of projects - * - * @return $this - */ - public function setProjectsList(array $projects_list = null): self - { - $this->projects_list = $projects_list; - - return $this; - } + /** + * The name of the categories in english. + * + * @var string|null + * @SerializedName("type") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $type; + + /** + * Translated name according to the language header + * + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * Array of projects + * + * @var \OpenAPI\Server\Model\ProjectResponse[]|null + * @SerializedName("projectsList") + * @Assert\All({ + * @Assert\Type("OpenAPI\Server\Model\ProjectResponse") + * }) + * @Type("array") + */ + protected ?array $projects_list; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->type = $data['type'] ?? null; + $this->name = $data['name'] ?? null; + $this->projects_list = $data['projects_list'] ?? null; + } + + /** + * Gets type. + * + * @return string|null + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets type. + * + * @param string|null $type The name of the categories in english. + * + * @return $this + */ + public function setType(string $type = null): self + { + $this->type = $type; + + return $this; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name Translated name according to the language header + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets projects_list. + * + * @return \OpenAPI\Server\Model\ProjectResponse[]|null + */ + public function getProjectsList(): ?array + { + return $this->projects_list; + } + + /** + * Sets projects_list. + * + * @param \OpenAPI\Server\Model\ProjectResponse[]|null $projects_list Array of projects + * + * @return $this + */ + public function setProjectsList(array $projects_list = null): self + { + $this->projects_list = $projects_list; + + return $this; + } } + + diff --git a/Model/RefreshRequest.php b/Model/RefreshRequest.php index b46425e6..4c13ac31 100644 --- a/Model/RefreshRequest.php +++ b/Model/RefreshRequest.php @@ -1,24 +1,24 @@ refresh_token = $data['refresh_token'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->refresh_token = $data['refresh_token'] ?? null; + } - /** - * Gets refresh_token. - */ - public function getRefreshToken(): ?string - { - return $this->refresh_token; - } + /** + * Gets refresh_token. + * + * @return string|null + */ + public function getRefreshToken(): ?string + { + return $this->refresh_token; + } - /** - * Sets refresh_token. - * - * @return $this - */ - public function setRefreshToken(string $refresh_token = null): self - { - $this->refresh_token = $refresh_token; + /** + * Sets refresh_token. + * + * @param string|null $refresh_token + * + * @return $this + */ + public function setRefreshToken(string $refresh_token = null): self + { + $this->refresh_token = $refresh_token; - return $this; - } + return $this; + } } + + diff --git a/Model/RegisterErrorResponse.php b/Model/RegisterErrorResponse.php index 78683510..16b40c53 100644 --- a/Model/RegisterErrorResponse.php +++ b/Model/RegisterErrorResponse.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - $this->username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } - - /** - * Sets password. - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; - - return $this; - } + /** + * @var string|null + * @SerializedName("email") + * @Assert\Choice({ "Email already in use", "Email invalid", "Email missing" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * @var string|null + * @SerializedName("username") + * @Assert\Choice({ "Username too short", "Username too long", "Username already in use", "Username missing", "Username must not contain an email address" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * @var string|null + * @SerializedName("password") + * @Assert\Choice({ "Password too short", "Password too long", "Password contains invalid chars", "Password missing" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $password; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * Sets password. + * + * @param string|null $password + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; + + return $this; + } } + + diff --git a/Model/RegisterRequest.php b/Model/RegisterRequest.php index 3d80093d..8130517c 100644 --- a/Model/RegisterRequest.php +++ b/Model/RegisterRequest.php @@ -1,24 +1,24 @@ dry_run = $data['dry_run'] ?? null; - $this->email = $data['email'] ?? null; - $this->username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - $this->picture = $data['picture'] ?? null; - $this->about = $data['about'] ?? null; - $this->currently_working_on = $data['currently_working_on'] ?? null; - } - - /** - * Gets dry_run. - */ - public function isDryRun(): ?bool - { - return $this->dry_run; - } - - /** - * Sets dry_run. - * - * @param bool|null $dry_run Indicates wether a request should only be verified or executed - * - * @return $this - */ - public function setDryRun(bool $dry_run = null): self - { - $this->dry_run = $dry_run; - - return $this; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @param string|null $email Email of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } - - /** - * Sets password. - * - * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @param string|null $picture the profile picture of the user in data URI scheme - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } - - /** - * Gets about. - */ - public function getAbout(): ?string - { - return $this->about; - } - - /** - * Sets about. - * - * @param string|null $about an introduction of the user - * - * @return $this - */ - public function setAbout(string $about = null): self - { - $this->about = $about; - - return $this; - } - - /** - * Gets currently_working_on. - */ - public function getCurrentlyWorkingOn(): ?string - { - return $this->currently_working_on; - } - - /** - * Sets currently_working_on. - * - * @param string|null $currently_working_on a short description about the project the user is currently working on - * - * @return $this - */ - public function setCurrentlyWorkingOn(string $currently_working_on = null): self - { - $this->currently_working_on = $currently_working_on; - - return $this; - } + /** + * Indicates wether a request should only be verified or executed + * + * @var bool|null + * @SerializedName("dry-run") + * @Assert\Type("bool") + * @Type("bool") + */ + protected ?bool $dry_run; + + /** + * Email of the user + * + * @var string|null + * @SerializedName("email") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * Name of the user | minLength: 3 | maxLength: 180 + * + * @var string|null + * @SerializedName("username") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * A secure password | minLength: 6 | maxLength: 4096 + * + * @var string|null + * @SerializedName("password") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $password; + + /** + * The profile picture of the user in data URI scheme. + * + * @var string|null + * @SerializedName("picture") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * An introduction of the user. + * + * @var string|null + * @SerializedName("about") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $about; + + /** + * A short description about the project the user is currently working on. + * + * @var string|null + * @SerializedName("currentlyWorkingOn") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $currently_working_on; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->dry_run = $data['dry_run'] ?? null; + $this->email = $data['email'] ?? null; + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + $this->picture = $data['picture'] ?? null; + $this->about = $data['about'] ?? null; + $this->currently_working_on = $data['currently_working_on'] ?? null; + } + + /** + * Gets dry_run. + * + * @return bool|null + */ + public function isDryRun(): ?bool + { + return $this->dry_run; + } + + /** + * Sets dry_run. + * + * @param bool|null $dry_run Indicates wether a request should only be verified or executed + * + * @return $this + */ + public function setDryRun(bool $dry_run = null): self + { + $this->dry_run = $dry_run; + + return $this; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email Email of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * Sets password. + * + * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture The profile picture of the user in data URI scheme. + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } + + /** + * Gets about. + * + * @return string|null + */ + public function getAbout(): ?string + { + return $this->about; + } + + /** + * Sets about. + * + * @param string|null $about An introduction of the user. + * + * @return $this + */ + public function setAbout(string $about = null): self + { + $this->about = $about; + + return $this; + } + + /** + * Gets currently_working_on. + * + * @return string|null + */ + public function getCurrentlyWorkingOn(): ?string + { + return $this->currently_working_on; + } + + /** + * Sets currently_working_on. + * + * @param string|null $currently_working_on A short description about the project the user is currently working on. + * + * @return $this + */ + public function setCurrentlyWorkingOn(string $currently_working_on = null): self + { + $this->currently_working_on = $currently_working_on; + + return $this; + } } + + diff --git a/Model/ResetPasswordErrorResponse.php b/Model/ResetPasswordErrorResponse.php index b1744758..2cc85cc0 100644 --- a/Model/ResetPasswordErrorResponse.php +++ b/Model/ResetPasswordErrorResponse.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + } - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } - /** - * Sets email. - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; + /** + * Sets email. + * + * @param string|null $email + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; - return $this; - } + return $this; + } } + + diff --git a/Model/ResetPasswordRequest.php b/Model/ResetPasswordRequest.php index bf441879..f9aae427 100644 --- a/Model/ResetPasswordRequest.php +++ b/Model/ResetPasswordRequest.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + } - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } - /** - * Sets email. - * - * @param string|null $email Email of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; + /** + * Sets email. + * + * @param string|null $email Email of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; - return $this; - } + return $this; + } } + + diff --git a/Model/SearchResponse.php b/Model/SearchResponse.php index 268106e6..521673c1 100644 --- a/Model/SearchResponse.php +++ b/Model/SearchResponse.php @@ -1,24 +1,24 @@ ") - */ - protected ?array $projects; - - /** - * @SerializedName("projects_total") - * @Assert\Type("int") - * @Type("int") - */ - protected ?int $projects_total; - - /** - * Array of users. - * - * @var \OpenAPI\Server\Model\BasicUserDataResponse[]|null - * @SerializedName("users") - * @Assert\All({ - * @Assert\Type("OpenAPI\Server\Model\BasicUserDataResponse") - * }) - * @Type("array") - */ - protected ?array $users; - - /** - * @SerializedName("users_total") - * @Assert\Type("int") - * @Type("int") - */ - protected ?int $users_total; - - /** - * Constructor. - * - * @param array|null $data Associated array of property values initializing the model - */ - public function __construct(array $data = null) - { - $this->projects = $data['projects'] ?? null; - $this->projects_total = $data['projects_total'] ?? null; - $this->users = $data['users'] ?? null; - $this->users_total = $data['users_total'] ?? null; - } - - /** - * Gets projects. - * - * @return \OpenAPI\Server\Model\ProjectResponse[]|null - */ - public function getProjects(): ?array - { - return $this->projects; - } - - /** - * Sets projects. - * - * @param \OpenAPI\Server\Model\ProjectResponse[]|null $projects Array of projects - * - * @return $this - */ - public function setProjects(array $projects = null): self - { - $this->projects = $projects; - - return $this; - } - - /** - * Gets projects_total. - */ - public function getProjectsTotal(): ?int - { - return $this->projects_total; - } - - /** - * Sets projects_total. - * - * @return $this - */ - public function setProjectsTotal(int $projects_total = null): self - { - $this->projects_total = $projects_total; - - return $this; - } - - /** - * Gets users. - * - * @return \OpenAPI\Server\Model\BasicUserDataResponse[]|null - */ - public function getUsers(): ?array - { - return $this->users; - } - - /** - * Sets users. - * - * @param \OpenAPI\Server\Model\BasicUserDataResponse[]|null $users Array of users - * - * @return $this - */ - public function setUsers(array $users = null): self - { - $this->users = $users; - - return $this; - } - - /** - * Gets users_total. - */ - public function getUsersTotal(): ?int - { - return $this->users_total; - } - - /** - * Sets users_total. - * - * @return $this - */ - public function setUsersTotal(int $users_total = null): self - { - $this->users_total = $users_total; - - return $this; - } + /** + * Array of projects + * + * @var \OpenAPI\Server\Model\ProjectResponse[]|null + * @SerializedName("projects") + * @Assert\All({ + * @Assert\Type("OpenAPI\Server\Model\ProjectResponse") + * }) + * @Type("array") + */ + protected ?array $projects; + + /** + * @var int|null + * @SerializedName("projects_total") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $projects_total; + + /** + * Array of users + * + * @var \OpenAPI\Server\Model\BasicUserDataResponse[]|null + * @SerializedName("users") + * @Assert\All({ + * @Assert\Type("OpenAPI\Server\Model\BasicUserDataResponse") + * }) + * @Type("array") + */ + protected ?array $users; + + /** + * @var int|null + * @SerializedName("users_total") + * @Assert\Type("int") + * @Type("int") + */ + protected ?int $users_total; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->projects = $data['projects'] ?? null; + $this->projects_total = $data['projects_total'] ?? null; + $this->users = $data['users'] ?? null; + $this->users_total = $data['users_total'] ?? null; + } + + /** + * Gets projects. + * + * @return \OpenAPI\Server\Model\ProjectResponse[]|null + */ + public function getProjects(): ?array + { + return $this->projects; + } + + /** + * Sets projects. + * + * @param \OpenAPI\Server\Model\ProjectResponse[]|null $projects Array of projects + * + * @return $this + */ + public function setProjects(array $projects = null): self + { + $this->projects = $projects; + + return $this; + } + + /** + * Gets projects_total. + * + * @return int|null + */ + public function getProjectsTotal(): ?int + { + return $this->projects_total; + } + + /** + * Sets projects_total. + * + * @param int|null $projects_total + * + * @return $this + */ + public function setProjectsTotal(int $projects_total = null): self + { + $this->projects_total = $projects_total; + + return $this; + } + + /** + * Gets users. + * + * @return \OpenAPI\Server\Model\BasicUserDataResponse[]|null + */ + public function getUsers(): ?array + { + return $this->users; + } + + /** + * Sets users. + * + * @param \OpenAPI\Server\Model\BasicUserDataResponse[]|null $users Array of users + * + * @return $this + */ + public function setUsers(array $users = null): self + { + $this->users = $users; + + return $this; + } + + /** + * Gets users_total. + * + * @return int|null + */ + public function getUsersTotal(): ?int + { + return $this->users_total; + } + + /** + * Sets users_total. + * + * @param int|null $users_total + * + * @return $this + */ + public function setUsersTotal(int $users_total = null): self + { + $this->users_total = $users_total; + + return $this; + } } + + diff --git a/Model/SurveyResponse.php b/Model/SurveyResponse.php index b04df258..8e4b7e13 100644 --- a/Model/SurveyResponse.php +++ b/Model/SurveyResponse.php @@ -1,24 +1,24 @@ url = $data['url'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->url = $data['url'] ?? null; + } - /** - * Gets url. - */ - public function getUrl(): ?string - { - return $this->url; - } + /** + * Gets url. + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->url; + } - /** - * Sets url. - * - * @param string|null $url Url to a survey for the given language - * - * @return $this - */ - public function setUrl(string $url = null): self - { - $this->url = $url; + /** + * Sets url. + * + * @param string|null $url Url to a survey for the given language + * + * @return $this + */ + public function setUrl(string $url = null): self + { + $this->url = $url; - return $this; - } + return $this; + } } + + diff --git a/Model/TagResponse.php b/Model/TagResponse.php index 5e8cc788..e84ff2c5 100644 --- a/Model/TagResponse.php +++ b/Model/TagResponse.php @@ -1,24 +1,24 @@ id = $data['id'] ?? null; - $this->text = $data['text'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->id = $data['id'] ?? null; + $this->text = $data['text'] ?? null; + } - /** - * Gets id. - */ - public function getId(): ?string - { - return $this->id; - } + /** + * Gets id. + * + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } - /** - * Sets id. - * - * @param string|null $id The internal title of the title - * - * @return $this - */ - public function setId(string $id = null): self - { - $this->id = $id; + /** + * Sets id. + * + * @param string|null $id The internal title of the title + * + * @return $this + */ + public function setId(string $id = null): self + { + $this->id = $id; - return $this; - } + return $this; + } - /** - * Gets text. - */ - public function getText(): ?string - { - return $this->text; - } + /** + * Gets text. + * + * @return string|null + */ + public function getText(): ?string + { + return $this->text; + } - /** - * Sets text. - * - * @param string|null $text the translated text of the project tag - * - * @return $this - */ - public function setText(string $text = null): self - { - $this->text = $text; + /** + * Sets text. + * + * @param string|null $text The translated text of the project tag. + * + * @return $this + */ + public function setText(string $text = null): self + { + $this->text = $text; - return $this; - } + return $this; + } } + + diff --git a/Model/UpdateProjectErrorResponse.php b/Model/UpdateProjectErrorResponse.php index c8ecd1d1..997c2503 100644 --- a/Model/UpdateProjectErrorResponse.php +++ b/Model/UpdateProjectErrorResponse.php @@ -1,24 +1,24 @@ name = $data['name'] ?? null; - $this->description = $data['description'] ?? null; - $this->credits = $data['credits'] ?? null; - $this->screenshot = $data['screenshot'] ?? null; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets description. - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * Sets description. - * - * @return $this - */ - public function setDescription(string $description = null): self - { - $this->description = $description; - - return $this; - } - - /** - * Gets credits. - */ - public function getCredits(): ?string - { - return $this->credits; - } - - /** - * Sets credits. - * - * @return $this - */ - public function setCredits(string $credits = null): self - { - $this->credits = $credits; - - return $this; - } - - /** - * Gets screenshot. - */ - public function getScreenshot(): ?string - { - return $this->screenshot; - } - - /** - * Sets screenshot. - * - * @return $this - */ - public function setScreenshot(string $screenshot = null): self - { - $this->screenshot = $screenshot; - - return $this; - } + /** + * @var string|null + * @SerializedName("name") + * @Assert\Choice({ "Name empty", "Name too long" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * @var string|null + * @SerializedName("description") + * @Assert\Choice({ "Description too long" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $description; + + /** + * @var string|null + * @SerializedName("credits") + * @Assert\Choice({ "Credits too long" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $credits; + + /** + * @var string|null + * @SerializedName("screenshot") + * @Assert\Choice({ "Project screenshot invalid or not supported" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $screenshot; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->name = $data['name'] ?? null; + $this->description = $data['description'] ?? null; + $this->credits = $data['credits'] ?? null; + $this->screenshot = $data['screenshot'] ?? null; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets description. + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets description. + * + * @param string|null $description + * + * @return $this + */ + public function setDescription(string $description = null): self + { + $this->description = $description; + + return $this; + } + + /** + * Gets credits. + * + * @return string|null + */ + public function getCredits(): ?string + { + return $this->credits; + } + + /** + * Sets credits. + * + * @param string|null $credits + * + * @return $this + */ + public function setCredits(string $credits = null): self + { + $this->credits = $credits; + + return $this; + } + + /** + * Gets screenshot. + * + * @return string|null + */ + public function getScreenshot(): ?string + { + return $this->screenshot; + } + + /** + * Sets screenshot. + * + * @param string|null $screenshot + * + * @return $this + */ + public function setScreenshot(string $screenshot = null): self + { + $this->screenshot = $screenshot; + + return $this; + } } + + diff --git a/Model/UpdateProjectFailureResponse.php b/Model/UpdateProjectFailureResponse.php index 123b03ec..310e3270 100644 --- a/Model/UpdateProjectFailureResponse.php +++ b/Model/UpdateProjectFailureResponse.php @@ -1,24 +1,24 @@ error = $data['error'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->error = $data['error'] ?? null; + } - /** - * Gets error. - */ - public function getError(): ?string - { - return $this->error; - } + /** + * Gets error. + * + * @return string|null + */ + public function getError(): ?string + { + return $this->error; + } - /** - * Sets error. - * - * @return $this - */ - public function setError(string $error = null): self - { - $this->error = $error; + /** + * Sets error. + * + * @param string|null $error + * + * @return $this + */ + public function setError(string $error = null): self + { + $this->error = $error; - return $this; - } + return $this; + } } + + diff --git a/Model/UpdateProjectRequest.php b/Model/UpdateProjectRequest.php index 583af43f..8b7ef117 100644 --- a/Model/UpdateProjectRequest.php +++ b/Model/UpdateProjectRequest.php @@ -1,24 +1,24 @@ name = $data['name'] ?? null; - $this->description = $data['description'] ?? null; - $this->credits = $data['credits'] ?? null; - $this->private = $data['private'] ?? null; - $this->screenshot = $data['screenshot'] ?? null; - } - - /** - * Gets name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * Sets name. - * - * @param string|null $name The name of the project. minLength: 1 | maxLength: 255 - * - * @return $this - */ - public function setName(string $name = null): self - { - $this->name = $name; - - return $this; - } - - /** - * Gets description. - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * Sets description. - * - * @param string|null $description a description of the project - * - * @return $this - */ - public function setDescription(string $description = null): self - { - $this->description = $description; - - return $this; - } - - /** - * Gets credits. - */ - public function getCredits(): ?string - { - return $this->credits; - } - - /** - * Sets credits. - * - * @param string|null $credits Credits and notes for the project. E.g., credits for using ideas, scripts or artwork from other people. - * - * @return $this - */ - public function setCredits(string $credits = null): self - { - $this->credits = $credits; - - return $this; - } - - /** - * Gets private. - */ - public function isPrivate(): ?bool - { - return $this->private; - } - - /** - * Sets private. - * - * @param bool|null $private whether a project is publicly visible (false) or only via direct link (true) - * - * @return $this - */ - public function setPrivate(bool $private = null): self - { - $this->private = $private; - - return $this; - } - - /** - * Gets screenshot. - */ - public function getScreenshot(): ?string - { - return $this->screenshot; - } - - /** - * Sets screenshot. - * - * @param string|null $screenshot an image representing the project in data URI scheme - * - * @return $this - */ - public function setScreenshot(string $screenshot = null): self - { - $this->screenshot = $screenshot; - - return $this; - } + /** + * The name of the project. minLength: 1 | maxLength: 255 + * + * @var string|null + * @SerializedName("name") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $name; + + /** + * A description of the project. + * + * @var string|null + * @SerializedName("description") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $description; + + /** + * Credits and notes for the project. E.g., credits for using ideas, scripts or artwork from other people. + * + * @var string|null + * @SerializedName("credits") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $credits; + + /** + * Whether a project is publicly visible (false) or only via direct link (true). + * + * @var bool|null + * @SerializedName("private") + * @Assert\Type("bool") + * @Type("bool") + */ + protected ?bool $private; + + /** + * An image representing the project in data URI scheme. + * + * @var string|null + * @SerializedName("screenshot") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $screenshot; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->name = $data['name'] ?? null; + $this->description = $data['description'] ?? null; + $this->credits = $data['credits'] ?? null; + $this->private = $data['private'] ?? null; + $this->screenshot = $data['screenshot'] ?? null; + } + + /** + * Gets name. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets name. + * + * @param string|null $name The name of the project. minLength: 1 | maxLength: 255 + * + * @return $this + */ + public function setName(string $name = null): self + { + $this->name = $name; + + return $this; + } + + /** + * Gets description. + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets description. + * + * @param string|null $description A description of the project. + * + * @return $this + */ + public function setDescription(string $description = null): self + { + $this->description = $description; + + return $this; + } + + /** + * Gets credits. + * + * @return string|null + */ + public function getCredits(): ?string + { + return $this->credits; + } + + /** + * Sets credits. + * + * @param string|null $credits Credits and notes for the project. E.g., credits for using ideas, scripts or artwork from other people. + * + * @return $this + */ + public function setCredits(string $credits = null): self + { + $this->credits = $credits; + + return $this; + } + + /** + * Gets private. + * + * @return bool|null + */ + public function isPrivate(): ?bool + { + return $this->private; + } + + /** + * Sets private. + * + * @param bool|null $private Whether a project is publicly visible (false) or only via direct link (true). + * + * @return $this + */ + public function setPrivate(bool $private = null): self + { + $this->private = $private; + + return $this; + } + + /** + * Gets screenshot. + * + * @return string|null + */ + public function getScreenshot(): ?string + { + return $this->screenshot; + } + + /** + * Sets screenshot. + * + * @param string|null $screenshot An image representing the project in data URI scheme. + * + * @return $this + */ + public function setScreenshot(string $screenshot = null): self + { + $this->screenshot = $screenshot; + + return $this; + } } + + diff --git a/Model/UpdateUserErrorResponse.php b/Model/UpdateUserErrorResponse.php index 5787bc93..2d659057 100644 --- a/Model/UpdateUserErrorResponse.php +++ b/Model/UpdateUserErrorResponse.php @@ -1,24 +1,24 @@ email = $data['email'] ?? null; - $this->username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - $this->current_password = $data['current_password'] ?? null; - $this->picture = $data['picture'] ?? null; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } - - /** - * Sets password. - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; - - return $this; - } - - /** - * Gets current_password. - */ - public function getCurrentPassword(): ?string - { - return $this->current_password; - } - - /** - * Sets current_password. - * - * @return $this - */ - public function setCurrentPassword(string $current_password = null): self - { - $this->current_password = $current_password; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } + /** + * @var string|null + * @SerializedName("email") + * @Assert\Choice({ "Email already in use", "Email invalid" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * @var string|null + * @SerializedName("username") + * @Assert\Choice({ "Username too short", "Username too long", "Username already in use", "Username must not contain an email address" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * @var string|null + * @SerializedName("password") + * @Assert\Choice({ "Password too short", "Password too long", "Password contains invalid chars" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $password; + + /** + * @var string|null + * @SerializedName("currentPassword") + * @Assert\Choice({ "Current password is missing", "Current password is wrong" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $current_password; + + /** + * @var string|null + * @SerializedName("picture") + * @Assert\Choice({ "Profile picture invalid or not supported" }) + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->email = $data['email'] ?? null; + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + $this->current_password = $data['current_password'] ?? null; + $this->picture = $data['picture'] ?? null; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * Sets password. + * + * @param string|null $password + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; + + return $this; + } + + /** + * Gets current_password. + * + * @return string|null + */ + public function getCurrentPassword(): ?string + { + return $this->current_password; + } + + /** + * Sets current_password. + * + * @param string|null $current_password + * + * @return $this + */ + public function setCurrentPassword(string $current_password = null): self + { + $this->current_password = $current_password; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } } + + diff --git a/Model/UpdateUserRequest.php b/Model/UpdateUserRequest.php index b038f455..96a47bc8 100644 --- a/Model/UpdateUserRequest.php +++ b/Model/UpdateUserRequest.php @@ -1,24 +1,24 @@ dry_run = $data['dry_run'] ?? null; - $this->email = $data['email'] ?? null; - $this->username = $data['username'] ?? null; - $this->password = $data['password'] ?? null; - $this->picture = $data['picture'] ?? null; - $this->about = $data['about'] ?? null; - $this->currently_working_on = $data['currently_working_on'] ?? null; - $this->current_password = $data['current_password'] ?? null; - } - - /** - * Gets dry_run. - */ - public function isDryRun(): ?bool - { - return $this->dry_run; - } - - /** - * Sets dry_run. - * - * @param bool|null $dry_run Indicates wether a request should only be verified or executed - * - * @return $this - */ - public function setDryRun(bool $dry_run = null): self - { - $this->dry_run = $dry_run; - - return $this; - } - - /** - * Gets email. - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * Sets email. - * - * @param string|null $email Email of the user - * - * @return $this - */ - public function setEmail(string $email = null): self - { - $this->email = $email; - - return $this; - } - - /** - * Gets username. - */ - public function getUsername(): ?string - { - return $this->username; - } - - /** - * Sets username. - * - * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 - * - * @return $this - */ - public function setUsername(string $username = null): self - { - $this->username = $username; - - return $this; - } - - /** - * Gets password. - */ - public function getPassword(): ?string - { - return $this->password; - } - - /** - * Sets password. - * - * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 - * - * @return $this - */ - public function setPassword(string $password = null): self - { - $this->password = $password; - - return $this; - } - - /** - * Gets picture. - */ - public function getPicture(): ?string - { - return $this->picture; - } - - /** - * Sets picture. - * - * @param string|null $picture the profile picture of the user in data URI scheme - * - * @return $this - */ - public function setPicture(string $picture = null): self - { - $this->picture = $picture; - - return $this; - } - - /** - * Gets about. - */ - public function getAbout(): ?string - { - return $this->about; - } - - /** - * Sets about. - * - * @param string|null $about an introduction of the user - * - * @return $this - */ - public function setAbout(string $about = null): self - { - $this->about = $about; - - return $this; - } - - /** - * Gets currently_working_on. - */ - public function getCurrentlyWorkingOn(): ?string - { - return $this->currently_working_on; - } - - /** - * Sets currently_working_on. - * - * @param string|null $currently_working_on a short description about the project the user is currently working on - * - * @return $this - */ - public function setCurrentlyWorkingOn(string $currently_working_on = null): self - { - $this->currently_working_on = $currently_working_on; - - return $this; - } - - /** - * Gets current_password. - */ - public function getCurrentPassword(): ?string - { - return $this->current_password; - } - - /** - * Sets current_password. - * - * @param string|null $current_password The current password of the user. Required for changing the password. - * - * @return $this - */ - public function setCurrentPassword(string $current_password = null): self - { - $this->current_password = $current_password; - - return $this; - } + /** + * Indicates wether a request should only be verified or executed + * + * @var bool|null + * @SerializedName("dry-run") + * @Assert\Type("bool") + * @Type("bool") + */ + protected ?bool $dry_run; + + /** + * Email of the user + * + * @var string|null + * @SerializedName("email") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $email; + + /** + * Name of the user | minLength: 3 | maxLength: 180 + * + * @var string|null + * @SerializedName("username") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $username; + + /** + * A secure password | minLength: 6 | maxLength: 4096 + * + * @var string|null + * @SerializedName("password") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $password; + + /** + * The profile picture of the user in data URI scheme. + * + * @var string|null + * @SerializedName("picture") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $picture; + + /** + * An introduction of the user. + * + * @var string|null + * @SerializedName("about") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $about; + + /** + * A short description about the project the user is currently working on. + * + * @var string|null + * @SerializedName("currentlyWorkingOn") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $currently_working_on; + + /** + * The current password of the user. Required for changing the password. + * + * @var string|null + * @SerializedName("currentPassword") + * @Assert\Type("string") + * @Type("string") + */ + protected ?string $current_password; + + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->dry_run = $data['dry_run'] ?? null; + $this->email = $data['email'] ?? null; + $this->username = $data['username'] ?? null; + $this->password = $data['password'] ?? null; + $this->picture = $data['picture'] ?? null; + $this->about = $data['about'] ?? null; + $this->currently_working_on = $data['currently_working_on'] ?? null; + $this->current_password = $data['current_password'] ?? null; + } + + /** + * Gets dry_run. + * + * @return bool|null + */ + public function isDryRun(): ?bool + { + return $this->dry_run; + } + + /** + * Sets dry_run. + * + * @param bool|null $dry_run Indicates wether a request should only be verified or executed + * + * @return $this + */ + public function setDryRun(bool $dry_run = null): self + { + $this->dry_run = $dry_run; + + return $this; + } + + /** + * Gets email. + * + * @return string|null + */ + public function getEmail(): ?string + { + return $this->email; + } + + /** + * Sets email. + * + * @param string|null $email Email of the user + * + * @return $this + */ + public function setEmail(string $email = null): self + { + $this->email = $email; + + return $this; + } + + /** + * Gets username. + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->username; + } + + /** + * Sets username. + * + * @param string|null $username Name of the user | minLength: 3 | maxLength: 180 + * + * @return $this + */ + public function setUsername(string $username = null): self + { + $this->username = $username; + + return $this; + } + + /** + * Gets password. + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * Sets password. + * + * @param string|null $password A secure password | minLength: 6 | maxLength: 4096 + * + * @return $this + */ + public function setPassword(string $password = null): self + { + $this->password = $password; + + return $this; + } + + /** + * Gets picture. + * + * @return string|null + */ + public function getPicture(): ?string + { + return $this->picture; + } + + /** + * Sets picture. + * + * @param string|null $picture The profile picture of the user in data URI scheme. + * + * @return $this + */ + public function setPicture(string $picture = null): self + { + $this->picture = $picture; + + return $this; + } + + /** + * Gets about. + * + * @return string|null + */ + public function getAbout(): ?string + { + return $this->about; + } + + /** + * Sets about. + * + * @param string|null $about An introduction of the user. + * + * @return $this + */ + public function setAbout(string $about = null): self + { + $this->about = $about; + + return $this; + } + + /** + * Gets currently_working_on. + * + * @return string|null + */ + public function getCurrentlyWorkingOn(): ?string + { + return $this->currently_working_on; + } + + /** + * Sets currently_working_on. + * + * @param string|null $currently_working_on A short description about the project the user is currently working on. + * + * @return $this + */ + public function setCurrentlyWorkingOn(string $currently_working_on = null): self + { + $this->currently_working_on = $currently_working_on; + + return $this; + } + + /** + * Gets current_password. + * + * @return string|null + */ + public function getCurrentPassword(): ?string + { + return $this->current_password; + } + + /** + * Sets current_password. + * + * @param string|null $current_password The current password of the user. Required for changing the password. + * + * @return $this + */ + public function setCurrentPassword(string $current_password = null): self + { + $this->current_password = $current_password; + + return $this; + } } + + diff --git a/Model/UpdateUserRequestAllOf.php b/Model/UpdateUserRequestAllOf.php index 0c51ab70..8d9ab6d8 100644 --- a/Model/UpdateUserRequestAllOf.php +++ b/Model/UpdateUserRequestAllOf.php @@ -1,24 +1,24 @@ current_password = $data['current_password'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->current_password = $data['current_password'] ?? null; + } - /** - * Gets current_password. - */ - public function getCurrentPassword(): ?string - { - return $this->current_password; - } + /** + * Gets current_password. + * + * @return string|null + */ + public function getCurrentPassword(): ?string + { + return $this->current_password; + } - /** - * Sets current_password. - * - * @param string|null $current_password The current password of the user. Required for changing the password. - * - * @return $this - */ - public function setCurrentPassword(string $current_password = null): self - { - $this->current_password = $current_password; + /** + * Sets current_password. + * + * @param string|null $current_password The current password of the user. Required for changing the password. + * + * @return $this + */ + public function setCurrentPassword(string $current_password = null): self + { + $this->current_password = $current_password; - return $this; - } + return $this; + } } + + diff --git a/Model/UpgradeTokenRequest.php b/Model/UpgradeTokenRequest.php index f4da970a..0da91ec0 100644 --- a/Model/UpgradeTokenRequest.php +++ b/Model/UpgradeTokenRequest.php @@ -1,24 +1,24 @@ upload_token = $data['upload_token'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->upload_token = $data['upload_token'] ?? null; + } - /** - * Gets upload_token. - */ - public function getUploadToken(): ?string - { - return $this->upload_token; - } + /** + * Gets upload_token. + * + * @return string|null + */ + public function getUploadToken(): ?string + { + return $this->upload_token; + } - /** - * Sets upload_token. - * - * @return $this - */ - public function setUploadToken(string $upload_token = null): self - { - $this->upload_token = $upload_token; + /** + * Sets upload_token. + * + * @param string|null $upload_token + * + * @return $this + */ + public function setUploadToken(string $upload_token = null): self + { + $this->upload_token = $upload_token; - return $this; - } + return $this; + } } + + diff --git a/Model/UploadErrorResponse.php b/Model/UploadErrorResponse.php index 3ceffb56..a746377b 100644 --- a/Model/UploadErrorResponse.php +++ b/Model/UploadErrorResponse.php @@ -1,24 +1,24 @@ error = $data['error'] ?? null; - } + /** + * Constructor + * @param array|null $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->error = $data['error'] ?? null; + } - /** - * Gets error. - */ - public function getError(): ?string - { - return $this->error; - } + /** + * Gets error. + * + * @return string|null + */ + public function getError(): ?string + { + return $this->error; + } - /** - * Sets error. - * - * @return $this - */ - public function setError(string $error = null): self - { - $this->error = $error; + /** + * Sets error. + * + * @param string|null $error + * + * @return $this + */ + public function setError(string $error = null): self + { + $this->error = $error; - return $this; - } + return $this; + } } + + diff --git a/OpenAPIServerBundle.php b/OpenAPIServerBundle.php index ff2f90a4..48eaf9f9 100644 --- a/OpenAPIServerBundle.php +++ b/OpenAPIServerBundle.php @@ -1,24 +1,24 @@ addCompilerPass(new OpenAPIServerApiPass()); - } + public function build(ContainerBuilder $container) + { + $container->addCompilerPass(new OpenAPIServerApiPass()); + } } diff --git a/README.md b/README.md index c25233ef..849eb2f8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ API for the Catrobat Share Platform This [Symfony](https://symfony.com/) bundle is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: v1.1.2 +- API version: v1.1.3 - Build package: org.openapitools.codegen.languages.PhpSymfonyServerCodegen For more information, please visit [https://share.catrob.at](https://share.catrob.at) diff --git a/Service/JmsSerializer.php b/Service/JmsSerializer.php index 3bb85644..c58f2207 100644 --- a/Service/JmsSerializer.php +++ b/Service/JmsSerializer.php @@ -2,79 +2,77 @@ namespace OpenAPI\Server\Service; -use DateTime; +use JMS\Serializer\SerializerBuilder; use JMS\Serializer\Naming\CamelCaseNamingStrategy; use JMS\Serializer\Naming\SerializedNameAnnotationStrategy; use JMS\Serializer\Serializer; -use JMS\Serializer\SerializerBuilder; -use JMS\Serializer\SerializerBuilder; use JMS\Serializer\Visitor\Factory\XmlDeserializationVisitorFactory; +use DateTime; use RuntimeException; class JmsSerializer implements SerializerInterface { - protected Serializer $serializer; - - public function __construct() - { - $namingStrategy = new SerializedNameAnnotationStrategy(new CamelCaseNamingStrategy()); - $this->serializer = SerializerBuilder::create() - ->setDeserializationVisitor('json', new StrictJsonDeserializationVisitorFactory()) - ->setDeserializationVisitor('xml', new XmlDeserializationVisitorFactory()) - ->setPropertyNamingStrategy($namingStrategy) - ->build() - ; - } - - /** - * {@inheritdoc} - */ - public function serialize($data, string $format): string - { - return SerializerBuilder::create()->build()->serialize($data, $this->convertFormat($format)); - } - - /** - * {@inheritdoc} - */ - public function deserialize($data, $type, $format) - { - if ('string' == $format) { - return $this->deserializeString($data, $type); + protected Serializer $serializer; + + public function __construct() + { + $namingStrategy = new SerializedNameAnnotationStrategy(new CamelCaseNamingStrategy()); + $this->serializer = SerializerBuilder::create() + ->setDeserializationVisitor('json', new StrictJsonDeserializationVisitorFactory()) + ->setDeserializationVisitor('xml', new XmlDeserializationVisitorFactory()) + ->setPropertyNamingStrategy($namingStrategy) + ->build(); } - // If we end up here, let JMS serializer handle the deserialization - return $this->serializer->deserialize($data, $type, $this->convertFormat($format)); - } + /** + * @inheritdoc + */ + public function serialize($data, string $format): string + { + return SerializerBuilder::create()->build()->serialize($data, $this->convertFormat($format)); + } + + /** + * @inheritdoc + */ + public function deserialize($data, $type, $format) + { + if ($format == 'string') { + return $this->deserializeString($data, $type); + } + + // If we end up here, let JMS serializer handle the deserialization + return $this->serializer->deserialize($data, $type, $this->convertFormat($format)); + } - private function convertFormat($format): ?string - { - switch ($format) { + private function convertFormat($format): ?string + { + switch ($format) { case 'application/json': return 'json'; case 'application/xml': return 'xml'; } - return null; - } - - private function deserializeString($data, $type) - { - // Figure out if we have an array format - if (1 === preg_match('/array<(csv|ssv|tsv|pipes),(int|string)>/i', $type, $matches)) { - return $this->deserializeArrayString($matches[1], $matches[2], $data); + return null; } - switch ($type) { + private function deserializeString($data, $type) + { + // Figure out if we have an array format + if (1 === preg_match('/array<(csv|ssv|tsv|pipes),(int|string)>/i', $type, $matches)) { + return $this->deserializeArrayString($matches[1], $matches[2], $data); + } + + switch ($type) { case 'int': case 'integer': if (is_int($data)) { - return $data; + return $data; } if (is_numeric($data)) { - return $data + 0; + return $data + 0; } break; @@ -82,12 +80,12 @@ private function deserializeString($data, $type) break; case 'boolean': case 'bool': - if ('true' === strtolower($data)) { - return true; + if (strtolower($data) === 'true') { + return true; } - if ('false' === strtolower($data)) { - return false; + if (strtolower($data) === 'false') { + return false; } break; @@ -95,21 +93,21 @@ private function deserializeString($data, $type) case '\DateTime': return new DateTime($data); default: - throw new RuntimeException(sprintf('Type %s is unsupported', $type)); + throw new RuntimeException(sprintf("Type %s is unsupported", $type)); } - // If we end up here, just return data - return $data; - } - - private function deserializeArrayString(string $format, string $type, ?array $data): array - { - if (null === $data) { - return []; + // If we end up here, just return data + return $data; } - // Parse the string using the correct separator - switch ($format) { + private function deserializeArrayString(string $format, string $type, ?array $data): array + { + if ($data === null) { + return []; + } + + // Parse the string using the correct separator + switch ($format) { case 'csv': $data = explode(',', $data); break; @@ -122,15 +120,15 @@ private function deserializeArrayString(string $format, string $type, ?array $da case 'pipes': $data = explode('|', $data); break; - default: + default; $data = []; } - // Deserialize each of the array elements - foreach ($data as $key => $item) { - $data[$key] = $this->deserializeString($item, $type); - } + // Deserialize each of the array elements + foreach ($data as $key => $item) { + $data[$key] = $this->deserializeString($item, $type); + } - return $data; - } + return $data; + } } diff --git a/Service/SerializerInterface.php b/Service/SerializerInterface.php index 96693201..7224563c 100644 --- a/Service/SerializerInterface.php +++ b/Service/SerializerInterface.php @@ -4,17 +4,24 @@ interface SerializerInterface { - /** - * Serializes the given data to the specified output format. - * - * @param object|array|scalar $data - */ - public function serialize($data, string $format): string; + /** + * Serializes the given data to the specified output format. + * + * @param object|array|scalar $data + * @param string $format + * + * @return string + */ + public function serialize($data, string $format): string; - /** - * Deserializes the given data to the specified type. - * - * @return object|array|scalar - */ - public function deserialize(string $data, string $type, string $format); + /** + * Deserializes the given data to the specified type. + * + * @param string $data + * @param string $type + * @param string $format + * + * @return object|array|scalar + */ + public function deserialize(string $data, string $type, string $format); } diff --git a/Service/StrictJsonDeserializationVisitor.php b/Service/StrictJsonDeserializationVisitor.php index 77f370fa..af59d95a 100644 --- a/Service/StrictJsonDeserializationVisitor.php +++ b/Service/StrictJsonDeserializationVisitor.php @@ -19,140 +19,141 @@ namespace OpenAPI\Server\Service; -use JMS\Serializer\GraphNavigatorInterface; use JMS\Serializer\JsonDeserializationVisitor; +use JMS\Serializer\GraphNavigatorInterface; use JMS\Serializer\Metadata\ClassMetadata; use JMS\Serializer\Metadata\PropertyMetadata; use JMS\Serializer\Visitor\DeserializationVisitorInterface; class StrictJsonDeserializationVisitor implements DeserializationVisitorInterface { - protected JsonDeserializationVisitor $jsonDeserializationVisitor; + protected JsonDeserializationVisitor $jsonDeserializationVisitor; - public function __construct( + public function __construct( int $options = 0, int $depth = 512 ) { - $this->jsonDeserializationVisitor = new JsonDeserializationVisitor($options, $depth); - } - - /** - * {@inheritdoc} - */ - public function visitNull($data, array $type) - { - return $this->jsonDeserializationVisitor->visitNull($data, $type); - } - - /** - * {@inheritdoc} - */ - public function visitString($data, array $type): string - { - if (!is_string($data)) { - throw TypeMismatchException::fromValue('string', $data); + $this->jsonDeserializationVisitor = new JsonDeserializationVisitor($options, $depth); + } + + /** + * {@inheritdoc} + */ + public function visitNull($data, array $type) + { + return $this->jsonDeserializationVisitor->visitNull($data, $type); + } + + /** + * {@inheritdoc} + */ + public function visitString($data, array $type): string + { + if (!is_string($data)) { + throw TypeMismatchException::fromValue('string', $data); + } + + return $this->jsonDeserializationVisitor->visitString($data, $type); + } + + /** + * {@inheritdoc} + */ + public function visitBoolean($data, array $type): bool + { + if (!is_bool($data)) { + throw TypeMismatchException::fromValue('boolean', $data); + } + + return $this->jsonDeserializationVisitor->visitBoolean($data, $type); + } + + /** + * {@inheritdoc} + */ + public function visitInteger($data, array $type): int + { + if (!is_int($data)) { + throw TypeMismatchException::fromValue('integer', $data); + } + + return $this->jsonDeserializationVisitor->visitInteger($data, $type); } - return $this->jsonDeserializationVisitor->visitString($data, $type); - } + /** + * {@inheritdoc} + */ + public function visitDouble($data, array $type): float + { + if (!is_float($data) && !is_integer($data)) { + throw TypeMismatchException::fromValue('double', $data); + } + + return $this->jsonDeserializationVisitor->visitDouble($data, $type); + } - /** - * {@inheritdoc} - */ - public function visitBoolean($data, array $type): bool - { - if (!is_bool($data)) { - throw TypeMismatchException::fromValue('boolean', $data); + /** + * {@inheritdoc} + */ + public function visitArray($data, array $type): array + { + return $this->jsonDeserializationVisitor->visitArray($data, $type); } - return $this->jsonDeserializationVisitor->visitBoolean($data, $type); - } + /** + * {@inheritdoc} + */ + public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string + { + return $this->jsonDeserializationVisitor->visitDiscriminatorMapProperty($data, $metadata); + } - /** - * {@inheritdoc} - */ - public function visitInteger($data, array $type): int - { - if (!is_int($data)) { - throw TypeMismatchException::fromValue('integer', $data); + /** + * {@inheritdoc} + */ + public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void + { + $this->jsonDeserializationVisitor->startVisitingObject($metadata, $data, $type); } - return $this->jsonDeserializationVisitor->visitInteger($data, $type); - } + /** + * {@inheritdoc} + */ + public function visitProperty(PropertyMetadata $metadata, $data) + { + return $this->jsonDeserializationVisitor->visitProperty($metadata, $data); + } - /** - * {@inheritdoc} - */ - public function visitDouble($data, array $type): float - { - if (!is_float($data) && !is_integer($data)) { - throw TypeMismatchException::fromValue('double', $data); + /** + * {@inheritdoc} + */ + public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object + { + return $this->jsonDeserializationVisitor->endVisitingObject($metadata, $data, $type); + } + + /** + * {@inheritdoc} + */ + public function getResult($data) + { + return $this->jsonDeserializationVisitor->getResult($data); + } + + /** + * {@inheritdoc} + */ + public function prepare($data) + { + return $this->jsonDeserializationVisitor->prepare($data); + } + + /** + * {@inheritdoc} + */ + public function setNavigator(GraphNavigatorInterface $navigator): void + { + $this->jsonDeserializationVisitor->setNavigator($navigator); } - return $this->jsonDeserializationVisitor->visitDouble($data, $type); - } - - /** - * {@inheritdoc} - */ - public function visitArray($data, array $type): array - { - return $this->jsonDeserializationVisitor->visitArray($data, $type); - } - - /** - * {@inheritdoc} - */ - public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string - { - return $this->jsonDeserializationVisitor->visitDiscriminatorMapProperty($data, $metadata); - } - - /** - * {@inheritdoc} - */ - public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void - { - $this->jsonDeserializationVisitor->startVisitingObject($metadata, $data, $type); - } - - /** - * {@inheritdoc} - */ - public function visitProperty(PropertyMetadata $metadata, $data) - { - return $this->jsonDeserializationVisitor->visitProperty($metadata, $data); - } - - /** - * {@inheritdoc} - */ - public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object - { - return $this->jsonDeserializationVisitor->endVisitingObject($metadata, $data, $type); - } - - /** - * {@inheritdoc} - */ - public function getResult($data) - { - return $this->jsonDeserializationVisitor->getResult($data); - } - - /** - * {@inheritdoc} - */ - public function prepare($data) - { - return $this->jsonDeserializationVisitor->prepare($data); - } - - /** - * {@inheritdoc} - */ - public function setNavigator(GraphNavigatorInterface $navigator): void - { - $this->jsonDeserializationVisitor->setNavigator($navigator); - } } diff --git a/Service/StrictJsonDeserializationVisitorFactory.php b/Service/StrictJsonDeserializationVisitorFactory.php index 204246c6..8e6977f6 100644 --- a/Service/StrictJsonDeserializationVisitorFactory.php +++ b/Service/StrictJsonDeserializationVisitorFactory.php @@ -9,26 +9,26 @@ final class StrictJsonDeserializationVisitorFactory implements DeserializationVisitorFactory { - private int $options = 0; + private int $options = 0; - private int $depth = 512; + private int $depth = 512; - public function getVisitor(): DeserializationVisitorInterface - { - return new StrictJsonDeserializationVisitor($this->options, $this->depth); - } + public function getVisitor(): DeserializationVisitorInterface + { + return new StrictJsonDeserializationVisitor($this->options, $this->depth); + } - public function setOptions(int $options): self - { - $this->options = $options; + public function setOptions(int $options): self + { + $this->options = $options; - return $this; - } + return $this; + } - public function setDepth(int $depth): self - { - $this->depth = $depth; + public function setDepth(int $depth): self + { + $this->depth = $depth; - return $this; - } + return $this; + } } diff --git a/Service/SymfonyValidator.php b/Service/SymfonyValidator.php index 66ebac6e..6c1c5686 100644 --- a/Service/SymfonyValidator.php +++ b/Service/SymfonyValidator.php @@ -6,15 +6,15 @@ class SymfonyValidator implements ValidatorInterface { - protected SymfonyValidatorInterface $validator; + protected SymfonyValidatorInterface $validator; - public function __construct(SymfonyValidatorInterface $validator) - { - $this->validator = $validator; - } + public function __construct(SymfonyValidatorInterface $validator) + { + $this->validator = $validator; + } - public function validate($value, $constraints = null, $groups = null) - { - return $this->validator->validate($value, $constraints, $groups); - } + public function validate($value, $constraints = null, $groups = null) + { + return $this->validator->validate($value, $constraints, $groups); + } } diff --git a/Service/TypeMismatchException.php b/Service/TypeMismatchException.php index 66236b35..6ec34a6c 100644 --- a/Service/TypeMismatchException.php +++ b/Service/TypeMismatchException.php @@ -22,31 +22,31 @@ class TypeMismatchException extends RuntimeException { - /** - * A handy method for building exception instance. - * - * @param string $expected_type - * @param mixed $actual_value - * - * @return TypeMismatchException - */ - public static function fromValue( + /** + * A handy method for building exception instance. + * + * @param string $expected_type + * @param mixed $actual_value + * @param DeserializationContext|null $context + * @return TypeMismatchException + */ + public static function fromValue( $expected_type, $actual_value, DeserializationContext $context = null ) { - if (null !== $context && count($context->getCurrentPath()) > 0) { - $property = sprintf('property "%s" to be ', implode('.', $context->getCurrentPath())); - } else { - $property = ''; - } + if (null !== $context && count($context->getCurrentPath()) > 0) { + $property = sprintf('property "%s" to be ', implode('.', $context->getCurrentPath())); + } else { + $property = ''; + } - return new static(sprintf( + return new static(sprintf( 'Expected %s%s, but got %s: %s', $property, $expected_type, gettype($actual_value), json_encode($actual_value) )); - } + } } diff --git a/Service/ValidatorInterface.php b/Service/ValidatorInterface.php index 9db81033..858b1280 100644 --- a/Service/ValidatorInterface.php +++ b/Service/ValidatorInterface.php @@ -7,22 +7,22 @@ interface ValidatorInterface { - /** - * Validates a value against a constraint or a list of constraints. - * - * If no constraint is passed, the constraint - * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. - * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed - * - * @return ConstraintViolationListInterface A list of constraint violations - * If the list is empty, validation - * succeeded - */ - public function validate($value, $constraints = null, $groups = null); + /** + * Validates a value against a constraint or a list of constraints. + * + * If no constraint is passed, the constraint + * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. + * + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate + * against + * @param array|null $groups The validation groups to + * validate. If none is given, + * "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations + * If the list is empty, validation + * succeeded + */ + public function validate($value, $constraints = null, $groups = null); } diff --git a/Tests/AppKernel.php b/Tests/AppKernel.php index 942b0951..88c6cd9f 100644 --- a/Tests/AppKernel.php +++ b/Tests/AppKernel.php @@ -3,25 +3,27 @@ namespace OpenAPI\Server\Tests; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; -use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { - public function registerBundles(): iterable - { - return [ - new FrameworkBundle(), - ]; - } + public function registerBundles(): iterable + { + $bundles = array( + new FrameworkBundle() + ); + + return $bundles; + } - /** - * @throws \Exception - * - * @return mixed - */ - public function registerContainerConfiguration(LoaderInterface $loader) - { - $loader->load(__DIR__.'/test_config.yml'); - } + /** + * @param LoaderInterface $loader + * @return mixed + * @throws \Exception + */ + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load(__DIR__.'/test_config.yml'); + } } diff --git a/Tests/Controller/ControllerTest.php b/Tests/Controller/ControllerTest.php index 1d0a316f..26e71f52 100644 --- a/Tests/Controller/ControllerTest.php +++ b/Tests/Controller/ControllerTest.php @@ -1,23 +1,23 @@ headers->set('CONTENT_TYPE', $contentType, true); // last one argument overrides header - $this->assertSame( + + /** + * Tests isContentTypeAllowed static method. + * + * @param string $contentType + * @param array $consumes + * @param bool $expectedReturn + * + * @covers ::isContentTypeAllowed + * @dataProvider provideArgumentsForIsContentTypeAllowed + */ + public function testIsContentTypeAllowed(string $contentType, array $consumes, bool $expectedReturn): void + { + $request = new Request(); + $request->headers->set('CONTENT_TYPE', $contentType, true);// last one argument overrides header + $this->assertSame( $expectedReturn, Controller::isContentTypeAllowed($request, $consumes), sprintf( @@ -66,56 +68,56 @@ public function testIsContentTypeAllowed(string $contentType, array $consumes, b implode(', ', $consumes) ) ); - } + } - public function provideArgumentsForIsContentTypeAllowed(): array - { - return [ - 'usual JSON content type' => [ - 'application/json', - ['application/json'], - true, - ], - 'extended content type from PR #6078' => [ - 'application/json; charset=utf-8', - ['application/json'], - true, - ], - 'more than one content types' => [ - 'application/json', - ['application/xml', 'application/json; charset=utf-8'], - true, - ], - 'empty consumes array' => [ - 'application/json', - [], - true, - ], - 'empty consumes and content type' => [ - null, - [], - true, - ], - 'consumes everything' => [ - 'application/json', - ['*/*'], - true, - ], - 'fancy custom content type' => [ - 'foobar/foobaz', - ['application/xml', 'foobar/foobaz; charset=utf-8'], - true, - ], - 'empty content type' => [ - null, - ['application/xml', 'application/json; charset=utf-8'], - false, - ], - 'content type out of consumes' => [ - 'text/html', - ['application/xml', 'application/json; charset=utf-8'], - false, - ], - ]; - } + public function provideArgumentsForIsContentTypeAllowed(): array + { + return [ + 'usual JSON content type' => [ + 'application/json', + ['application/json'], + true, + ], + 'extended content type from PR #6078' => [ + 'application/json; charset=utf-8', + ['application/json'], + true, + ], + 'more than one content types' => [ + 'application/json', + ['application/xml', 'application/json; charset=utf-8'], + true, + ], + 'empty consumes array' => [ + 'application/json', + [], + true, + ], + 'empty consumes and content type' => [ + null, + [], + true, + ], + 'consumes everything' => [ + 'application/json', + ['*/*'], + true, + ], + 'fancy custom content type' => [ + 'foobar/foobaz', + ['application/xml', 'foobar/foobaz; charset=utf-8'], + true, + ], + 'empty content type' => [ + null, + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + 'content type out of consumes' => [ + 'text/html', + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + ]; + } } diff --git a/autoload.php b/autoload.php index aea2d3ef..6d05ec60 100644 --- a/autoload.php +++ b/autoload.php @@ -1,16 +1,17 @@