Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Catrobat/Catroweb-API
Browse files Browse the repository at this point in the history
  • Loading branch information
dmetzner committed Jan 28, 2022
2 parents f5ed15d + 6a166ea commit 3e65148
Show file tree
Hide file tree
Showing 58 changed files with 433 additions and 107 deletions.
4 changes: 4 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Model/DryRun.php
Model/ExtendedUserDataResponse.php
Model/ExtendedUserDataResponseAllOf.php
Model/FeaturedProjectResponse.php
Model/InlineObject.php
Model/JWTResponse.php
Model/LoginRequest.php
Model/MediaCategoryResponse.php
Expand Down Expand Up @@ -64,6 +65,7 @@ Resources/docs/Model/DryRun.md
Resources/docs/Model/ExtendedUserDataResponse.md
Resources/docs/Model/ExtendedUserDataResponseAllOf.md
Resources/docs/Model/FeaturedProjectResponse.md
Resources/docs/Model/InlineObject.md
Resources/docs/Model/JWTResponse.md
Resources/docs/Model/LoginRequest.md
Resources/docs/Model/MediaCategoryResponse.md
Expand All @@ -88,6 +90,7 @@ Resources/docs/Model/UpgradeTokenRequest.md
Resources/docs/Model/UploadErrorResponse.md
Service/JmsSerializer.php
Service/SerializerInterface.php
Service/StrictJsonDeserializationVisitor.php
Service/SymfonyValidator.php
Service/TypeMismatchException.php
Service/ValidatorInterface.php
Expand All @@ -106,6 +109,7 @@ Tests/Model/DryRunTest.php
Tests/Model/ExtendedUserDataResponseAllOfTest.php
Tests/Model/ExtendedUserDataResponseTest.php
Tests/Model/FeaturedProjectResponseTest.php
Tests/Model/InlineObjectTest.php
Tests/Model/JWTResponseTest.php
Tests/Model/LoginRequestTest.php
Tests/Model/MediaCategoryResponseTest.php
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Api/ApiServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Api/AuthenticationApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Api/MediaLibraryApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Api/NotificationsApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Api/ProjectsApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Api/SearchApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
14 changes: 13 additions & 1 deletion Api/UserApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand All @@ -28,6 +28,7 @@

namespace OpenAPI\Server\Api;

use OpenAPI\Server\Model\InlineObject;
use OpenAPI\Server\Model\RegisterRequest;
use OpenAPI\Server\Model\UpdateUserRequest;

Expand Down Expand Up @@ -112,6 +113,17 @@ public function userPost(RegisterRequest $register_request, string $accept_langu
*/
public function userPut(UpdateUserRequest $update_user_request, string $accept_language = null, &$responseCode, array &$responseHeaders);

/**
* Operation userResetPasswordPost.
*
* Request email to reset password
*
* @param \OpenAPI\Server\Model\InlineObject $inline_object (required)
* @param \int $responseCode The HTTP response code to return
* @param \array $responseHeaders Additional HTTP headers to return with the response ()
*/
public function userResetPasswordPost(InlineObject $inline_object, &$responseCode, array &$responseHeaders);

/**
* Operation usersSearchGet.
*
Expand Down
2 changes: 1 addition & 1 deletion Api/UtilityApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/AuthenticationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/MediaLibraryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/NotificationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/ProjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
84 changes: 83 additions & 1 deletion Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down Expand Up @@ -488,6 +488,88 @@ public function userPutAction(Request $request)
}
}

/**
* 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);
}

// Handle authentication

// Read out all input parameter values into variables
$inline_object = $request->getContent();

// Use the default value if no value was provided

// Deserialize the input values that needs it
try {
$inputFormat = $request->getMimeType($request->getContentType());
$inline_object = $this->deserialize($inline_object, 'OpenAPI\Server\Model\InlineObject', $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\\InlineObject');
$asserts[] = new Assert\Valid();
$response = $this->validate($inline_object, $asserts);
if ($response instanceof Response) {
return $response;
}

try {
$handler = $this->getApiHandler();

// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->userResetPasswordPost($inline_object, $responseCode, $responseHeaders);

// Find default response message
$message = '';

// Find a more specific message, if available
switch ($responseCode) {
case 204:
$message = 'If an account with the provided email exists, an email to reset the password has been send to the user.';
break;
case 400:
$message = 'Bad request (Invalid, or missing parameters)';
break;
case 415:
$message = 'Unsupported Media Type - request must use application/json as content type';
break;
}

return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message,
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}

/**
* Operation usersSearchGet.
*
Expand Down
2 changes: 1 addition & 1 deletion Controller/UtilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/OpenAPIServerApiPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/OpenAPIServerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/BaseUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/BasicUserDataResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/DryRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/ExtendedUserDataResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/ExtendedUserDataResponseAllOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/FeaturedProjectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* API for the Catrobat Share Platform
*
* The version of the OpenAPI document: v1.1.0
* The version of the OpenAPI document: v1.0.65
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
Loading

0 comments on commit 3e65148

Please sign in to comment.