Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
34 changes: 31 additions & 3 deletions 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.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand All @@ -42,7 +42,35 @@
interface MediaLibraryApiInterface
{
/**
* Operation mediaFileSearchGet.
* Operation mediaFileIdGet.
*
* Get the information of a specific media file
*
* @param int $id ID of any given media file (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\MediaFile
*/
public function mediaFileIdGet(int $id, &$responseCode, array &$responseHeaders);

/**
* Operation mediaFilesGet.
*
* Get *all* content of the media library.
*
* @param int $limit (optional, default to 20)
* @param int $offset (optional, default to 0)
* @param string $flavor (optional)
* @param int $responseCode The HTTP response code to return
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return OpenAPI\Server\Model\MediaFiles
*/
public function mediaFilesGet(int $limit = 20, int $offset = 0, string $flavor = null, &$responseCode, array &$responseHeaders);

/**
* Operation mediaFilesSearchGet.
*
* Search for mediafiles associated with keywords
*
Expand All @@ -56,7 +84,7 @@ interface MediaLibraryApiInterface
*
* @return OpenAPI\Server\Model\MediaFiles
*/
public function mediaFileSearchGet(string $query_string, string $flavor = null, int $limit = 20, int $offset = 0, string $package_name = null, &$responseCode, array &$responseHeaders);
public function mediaFilesSearchGet(string $query_string, string $flavor = null, int $limit = 20, int $offset = 0, string $package_name = null, &$responseCode, array &$responseHeaders);

/**
* Operation mediaPackagePackageNameGet.
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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
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.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
210 changes: 206 additions & 4 deletions 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.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down Expand Up @@ -50,15 +50,217 @@
class MediaLibraryController extends Controller
{
/**
* Operation mediaFileSearchGet.
* 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

// Use the default value if no value was provided

// Deserialize the input values that needs it
try
{
$id = $this->deserialize($id, 'int', '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;
}

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

// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];
$result = $handler->mediaFileIdGet($id, $responseCode, $responseHeaders);

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

// Find a more specific message, if available
switch ($responseCode) {
case 200:
$message = 'OK';
break;
case 400:
$message = 'BAD Request - invalid or missing required parameters';
break;
case 406:
$message = 'Not Acceptable - client must accept 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));
}
}

/**
* 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');
$offset = $request->query->get('offset');
$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');
$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\Choice(['pocketcode', 'pocketalice', 'pocketgalaxy', 'pocketphiro', 'phirocode', 'luna', 'create@school', 'embroidery', 'arduino']);
$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, $flavor, $responseCode, $responseHeaders);

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

// Find a more specific message, if available
switch ($responseCode) {
case 200:
$message = 'OK';
break;
case 400:
$message = 'BAD Request - invalid or missing required parameters';
break;
case 406:
$message = 'Not Acceptable - client must accept 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));
}
}

/**
* Operation mediaFilesSearchGet.
*
* Search for mediafiles associated with keywords
*
* @param Request $request the Symfony request to handle
*
* @return Response the Symfony response
*/
public function mediaFileSearchGetAction(Request $request)
public function mediaFilesSearchGetAction(Request $request)
{
// Figure out what data format to return to the client
$produces = ['application/json'];
Expand Down Expand Up @@ -143,7 +345,7 @@ public function mediaFileSearchGetAction(Request $request)
// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];
$result = $handler->mediaFileSearchGet($query_string, $flavor, $limit, $offset, $package_name, $responseCode, $responseHeaders);
$result = $handler->mediaFilesSearchGet($query_string, $flavor, $limit, $offset, $package_name, $responseCode, $responseHeaders);

// Find default response message
$message = 'OK';
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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* 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.0.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
2 changes: 1 addition & 1 deletion Model/FeaturedProject.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.37
* The version of the OpenAPI document: v1.0.39
* Contact: webmaster@catrobat.org
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
Expand Down
Loading