Skip to content

Commit

Permalink
Merge pull request #100 from Catrobat/create-pull-request/patch-16193…
Browse files Browse the repository at this point in the history
…68486

Bump autogenerated OpenAPI code
  • Loading branch information
dmetzner authored Apr 25, 2021
2 parents 5ad98b0 + f9efd97 commit d32dab4
Show file tree
Hide file tree
Showing 61 changed files with 705 additions and 212 deletions.
6 changes: 6 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Model/BaseUser.php
Model/BasicUserDataResponse.php
Model/DryRun.php
Model/ExtendedUserDataResponse.php
Model/ExtendedUserDataResponseAllOf.php
Model/FeaturedProjectResponse.php
Model/JWTResponse.php
Model/LoginRequest.php
Expand All @@ -45,6 +46,7 @@ Model/SurveyResponse.php
Model/UpdateUserErrorResponse.php
Model/UpdateUserRequest.php
Model/UpdateUserRequestAllOf.php
Model/UpgradeTokenRequest.php
Model/UploadErrorResponse.php
OpenAPIServerBundle.php
README.md
Expand All @@ -61,6 +63,7 @@ Resources/docs/Model/BaseUser.md
Resources/docs/Model/BasicUserDataResponse.md
Resources/docs/Model/DryRun.md
Resources/docs/Model/ExtendedUserDataResponse.md
Resources/docs/Model/ExtendedUserDataResponseAllOf.md
Resources/docs/Model/FeaturedProjectResponse.md
Resources/docs/Model/JWTResponse.md
Resources/docs/Model/LoginRequest.md
Expand All @@ -83,6 +86,7 @@ Resources/docs/Model/SurveyResponse.md
Resources/docs/Model/UpdateUserErrorResponse.md
Resources/docs/Model/UpdateUserRequest.md
Resources/docs/Model/UpdateUserRequestAllOf.md
Resources/docs/Model/UpgradeTokenRequest.md
Resources/docs/Model/UploadErrorResponse.md
Service/JmsSerializer.php
Service/SerializerInterface.php
Expand All @@ -102,6 +106,7 @@ 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/FeaturedProjectResponseTest.php
Tests/Model/JWTResponseTest.php
Expand All @@ -125,6 +130,7 @@ Tests/Model/SurveyResponseTest.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
Expand Down
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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
18 changes: 16 additions & 2 deletions 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand All @@ -31,6 +31,7 @@
use OpenAPI\Server\Model\LoginRequest;
use OpenAPI\Server\Model\OAuthLoginRequest;
use OpenAPI\Server\Model\RefreshRequest;
use OpenAPI\Server\Model\UpgradeTokenRequest;

/**
* AuthenticationApiInterface Interface Doc Comment.
Expand Down Expand Up @@ -100,7 +101,7 @@ public function authenticationPost(LoginRequest $login_request, &$responseCode,
/**
* Operation authenticationRefreshPost.
*
* Refresh token
* Refresh token -- StatusCode: 501 - Not yet implemented
*
* @param OpenAPI\Server\Model\RefreshRequest $refresh_request (required)
* @param int $responseCode The HTTP response code to return
Expand All @@ -109,4 +110,17 @@ public function authenticationPost(LoginRequest $login_request, &$responseCode,
* @return OpenAPI\Server\Model\JWTResponse
*/
public function authenticationRefreshPost(RefreshRequest $refresh_request, &$responseCode, array &$responseHeaders);

/**
* Operation authenticationUpgradePost.
*
* Upgrade a deprecated token -- StatusCode: 501 - Not yet implemented
*
* @param OpenAPI\Server\Model\UpgradeTokenRequest $upgrade_token_request (required)
* @param int $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return OpenAPI\Server\Model\JWTResponse
*/
public function authenticationUpgradePost(UpgradeTokenRequest $upgrade_token_request, &$responseCode, array &$responseHeaders);
}
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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
10 changes: 5 additions & 5 deletions 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down Expand Up @@ -51,7 +51,7 @@ public function setPandaAuth($value);
/**
* Operation notificationIdReadPut.
*
* Mark specified notification as read
* Mark specified notification as read - StatusCode: 501 - Not yet implemented
*
* @param int $id (required)
* @param string $accept_language (optional)
Expand All @@ -63,7 +63,7 @@ public function notificationIdReadPut(int $id, string $accept_language = null, &
/**
* Operation notificationsCountGet.
*
* Count the number of unseen notifications
* Count the number of unseen notifications -- StatusCode: 501 - Not yet implemented
*
* @param int $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response ()
Expand All @@ -75,7 +75,7 @@ public function notificationsCountGet(&$responseCode, array &$responseHeaders);
/**
* Operation notificationsGet.
*
* Get user notifications
* Get user notifications -- StatusCode: 501 - Not yet implemented
*
* @param string $accept_language (optional)
* @param int $limit (optional, default to 20)
Expand All @@ -91,7 +91,7 @@ public function notificationsGet(string $accept_language = null, int $limit = 20
/**
* Operation notificationsReadPut.
*
* Mark all notifications as read
* Mark all notifications as read -- StatusCode: 501 - Not yet implemented
*
* @param int $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response ()
Expand Down
15 changes: 13 additions & 2 deletions 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down Expand Up @@ -49,6 +49,17 @@ interface ProjectsApiInterface
*/
public function setPandaAuth($value);

/**
* Operation projectIdDelete.
*
* Delete a project -- StatusCode: 501 - Not yet implemented
*
* @param string $id (required)
* @param int $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*/
public function projectIdDelete(string $id, &$responseCode, array &$responseHeaders);

/**
* Operation projectIdGet.
*
Expand Down Expand Up @@ -84,7 +95,7 @@ public function projectIdRecommendationsGet(string $id, string $category, string
/**
* Operation projectIdReportPost.
*
* Report a project
* Report a project -- StatusCode: 501 - Not yet implemented
*
* @param string $id (required)
* @param OpenAPI\Server\Model\ProjectReportRequest $project_report_request (required)
Expand Down
4 changes: 2 additions & 2 deletions 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand All @@ -42,7 +42,7 @@ interface SearchApiInterface
/**
* Operation searchGet.
*
* Search for projects, users,... The default is to search for all types.
* Search for projects, users,.. -- StatusCode: 501 - Not yet implemented
*
* @param string $query (required)
* @param string $type (optional)
Expand Down
2 changes: 1 addition & 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
102 changes: 100 additions & 2 deletions 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down Expand Up @@ -402,7 +402,7 @@ public function authenticationPostAction(Request $request)
/**
* Operation authenticationRefreshPost.
*
* Refresh token
* Refresh token -- StatusCode: 501 - Not yet implemented
*
* @param Request $request the Symfony request to handle
*
Expand Down Expand Up @@ -503,6 +503,104 @@ public function authenticationRefreshPostAction(Request $request)
}
}

/**
* Operation authenticationUpgradePost.
*
* Upgrade a deprecated token -- StatusCode: 501 - Not yet implemented
*
* @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);
}

// 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;
case 400:
$message = 'Bad request (Invalid, or missing parameters)';
break;
case 401:
$message = 'The provided deprecated upload token is invalid or has expired';
break;
case 406:
$message = 'Not acceptable - client must accept application/json as content type';
break;
case 415:
$message = 'Unsupported Media Type - request must use application/json as content type';
break;
}

return new Response(
null !== $result ? $this->serialize($result, $responseFormat) : '',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message,
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}

/**
* Returns the handler for this API controller.
*
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.0.61
* The version of the OpenAPI document: v1.0.62
* 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.0.61
* The version of the OpenAPI document: v1.0.62
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
Loading

0 comments on commit d32dab4

Please sign in to comment.