Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Commit 4de9a05

Browse files
committed
minor changes
- add new routes for GSoC Student - add unused objects for future use
1 parent 98ac0a5 commit 4de9a05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1574
-70
lines changed

Api/ApiServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/

Api/AuthenticationApiInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* API for the Catrobat Share Platform
1717
*
18-
* The version of the OpenAPI document: v1.0.37
18+
* The version of the OpenAPI document: v1.0.39
1919
* Contact: webmaster@catrobat.org
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*/

Api/MediaLibraryApiInterface.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* API for the Catrobat Share Platform
1717
*
18-
* The version of the OpenAPI document: v1.0.37
18+
* The version of the OpenAPI document: v1.0.39
1919
* Contact: webmaster@catrobat.org
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*/
@@ -42,7 +42,35 @@
4242
interface MediaLibraryApiInterface
4343
{
4444
/**
45-
* Operation mediaFileSearchGet.
45+
* Operation mediaFileIdGet.
46+
*
47+
* Get the information of a specific media file
48+
*
49+
* @param int $id ID of any given media file (required)
50+
* @param int $responseCode The HTTP response code to return
51+
* @param array $responseHeaders Additional HTTP headers to return with the response ()
52+
*
53+
* @return OpenAPI\Server\Model\MediaFile
54+
*/
55+
public function mediaFileIdGet(int $id, &$responseCode, array &$responseHeaders);
56+
57+
/**
58+
* Operation mediaFilesGet.
59+
*
60+
* Get *all* content of the media library.
61+
*
62+
* @param int $limit (optional, default to 20)
63+
* @param int $offset (optional, default to 0)
64+
* @param string $flavor (optional)
65+
* @param int $responseCode The HTTP response code to return
66+
* @param array $responseHeaders Additional HTTP headers to return with the response ()
67+
*
68+
* @return OpenAPI\Server\Model\MediaFiles
69+
*/
70+
public function mediaFilesGet(int $limit = 20, int $offset = 0, string $flavor = null, &$responseCode, array &$responseHeaders);
71+
72+
/**
73+
* Operation mediaFilesSearchGet.
4674
*
4775
* Search for mediafiles associated with keywords
4876
*
@@ -56,7 +84,7 @@ interface MediaLibraryApiInterface
5684
*
5785
* @return OpenAPI\Server\Model\MediaFiles
5886
*/
59-
public function mediaFileSearchGet(string $query_string, string $flavor = null, int $limit = 20, int $offset = 0, string $package_name = null, &$responseCode, array &$responseHeaders);
87+
public function mediaFilesSearchGet(string $query_string, string $flavor = null, int $limit = 20, int $offset = 0, string $package_name = null, &$responseCode, array &$responseHeaders);
6088

6189
/**
6290
* Operation mediaPackagePackageNameGet.

Api/ProjectsApiInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* API for the Catrobat Share Platform
1717
*
18-
* The version of the OpenAPI document: v1.0.37
18+
* The version of the OpenAPI document: v1.0.39
1919
* Contact: webmaster@catrobat.org
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*/

Api/UserApiInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* API for the Catrobat Share Platform
1717
*
18-
* The version of the OpenAPI document: v1.0.37
18+
* The version of the OpenAPI document: v1.0.39
1919
* Contact: webmaster@catrobat.org
2020
* Generated by: https://github.com/openapitools/openapi-generator.git
2121
*/

Controller/AuthenticationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/

Controller/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/

Controller/MediaLibraryController.php

Lines changed: 206 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/
@@ -50,15 +50,217 @@
5050
class MediaLibraryController extends Controller
5151
{
5252
/**
53-
* Operation mediaFileSearchGet.
53+
* Operation mediaFileIdGet.
54+
*
55+
* Get the information of a specific media file
56+
*
57+
* @param Request $request the Symfony request to handle
58+
* @param mixed $id
59+
*
60+
* @return Response the Symfony response
61+
*/
62+
public function mediaFileIdGetAction(Request $request, $id)
63+
{
64+
// Figure out what data format to return to the client
65+
$produces = ['application/json'];
66+
// Figure out what the client accepts
67+
$clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*';
68+
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
69+
if (null === $responseFormat)
70+
{
71+
return new Response('', 406);
72+
}
73+
74+
// Handle authentication
75+
76+
// Read out all input parameter values into variables
77+
78+
// Use the default value if no value was provided
79+
80+
// Deserialize the input values that needs it
81+
try
82+
{
83+
$id = $this->deserialize($id, 'int', 'string');
84+
}
85+
catch (SerializerRuntimeException $exception)
86+
{
87+
return $this->createBadRequestResponse($exception->getMessage());
88+
}
89+
90+
// Validate the input values
91+
$asserts = [];
92+
$asserts[] = new Assert\NotNull();
93+
$asserts[] = new Assert\Type('int');
94+
$response = $this->validate($id, $asserts);
95+
if ($response instanceof Response)
96+
{
97+
return $response;
98+
}
99+
100+
try
101+
{
102+
$handler = $this->getApiHandler();
103+
104+
// Make the call to the business logic
105+
$responseCode = 200;
106+
$responseHeaders = [];
107+
$result = $handler->mediaFileIdGet($id, $responseCode, $responseHeaders);
108+
109+
// Find default response message
110+
$message = 'OK';
111+
112+
// Find a more specific message, if available
113+
switch ($responseCode) {
114+
case 200:
115+
$message = 'OK';
116+
break;
117+
case 400:
118+
$message = 'BAD Request - invalid or missing required parameters';
119+
break;
120+
case 406:
121+
$message = 'Not Acceptable - client must accept application/json as content type';
122+
break;
123+
}
124+
125+
return new Response(
126+
null !== $result ? $this->serialize($result, $responseFormat) : '',
127+
$responseCode,
128+
array_merge(
129+
$responseHeaders,
130+
[
131+
'Content-Type' => $responseFormat,
132+
'X-OpenAPI-Message' => $message,
133+
]
134+
)
135+
);
136+
}
137+
catch (Exception $fallthrough)
138+
{
139+
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
140+
}
141+
}
142+
143+
/**
144+
* Operation mediaFilesGet.
145+
*
146+
* Get *all* content of the media library.
147+
*
148+
* @param Request $request the Symfony request to handle
149+
*
150+
* @return Response the Symfony response
151+
*/
152+
public function mediaFilesGetAction(Request $request)
153+
{
154+
// Figure out what data format to return to the client
155+
$produces = ['application/json'];
156+
// Figure out what the client accepts
157+
$clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*';
158+
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
159+
if (null === $responseFormat)
160+
{
161+
return new Response('', 406);
162+
}
163+
164+
// Handle authentication
165+
166+
// Read out all input parameter values into variables
167+
$limit = $request->query->get('limit');
168+
$offset = $request->query->get('offset');
169+
$flavor = $request->query->get('flavor');
170+
171+
// Use the default value if no value was provided
172+
173+
// Deserialize the input values that needs it
174+
try
175+
{
176+
$limit = $this->deserialize($limit, 'int', 'string');
177+
$offset = $this->deserialize($offset, 'int', 'string');
178+
$flavor = $this->deserialize($flavor, 'string', 'string');
179+
}
180+
catch (SerializerRuntimeException $exception)
181+
{
182+
return $this->createBadRequestResponse($exception->getMessage());
183+
}
184+
185+
// Validate the input values
186+
$asserts = [];
187+
$asserts[] = new Assert\Type('int');
188+
$asserts[] = new Assert\GreaterThanOrEqual(0);
189+
$response = $this->validate($limit, $asserts);
190+
if ($response instanceof Response)
191+
{
192+
return $response;
193+
}
194+
$asserts = [];
195+
$asserts[] = new Assert\Type('int');
196+
$asserts[] = new Assert\GreaterThanOrEqual(0);
197+
$response = $this->validate($offset, $asserts);
198+
if ($response instanceof Response)
199+
{
200+
return $response;
201+
}
202+
$asserts = [];
203+
$asserts[] = new Assert\Choice(['pocketcode', 'pocketalice', 'pocketgalaxy', 'pocketphiro', 'phirocode', 'luna', 'create@school', 'embroidery', 'arduino']);
204+
$asserts[] = new Assert\Type('string');
205+
$response = $this->validate($flavor, $asserts);
206+
if ($response instanceof Response)
207+
{
208+
return $response;
209+
}
210+
211+
try
212+
{
213+
$handler = $this->getApiHandler();
214+
215+
// Make the call to the business logic
216+
$responseCode = 200;
217+
$responseHeaders = [];
218+
$result = $handler->mediaFilesGet($limit, $offset, $flavor, $responseCode, $responseHeaders);
219+
220+
// Find default response message
221+
$message = 'OK';
222+
223+
// Find a more specific message, if available
224+
switch ($responseCode) {
225+
case 200:
226+
$message = 'OK';
227+
break;
228+
case 400:
229+
$message = 'BAD Request - invalid or missing required parameters';
230+
break;
231+
case 406:
232+
$message = 'Not Acceptable - client must accept application/json as content type';
233+
break;
234+
}
235+
236+
return new Response(
237+
null !== $result ? $this->serialize($result, $responseFormat) : '',
238+
$responseCode,
239+
array_merge(
240+
$responseHeaders,
241+
[
242+
'Content-Type' => $responseFormat,
243+
'X-OpenAPI-Message' => $message,
244+
]
245+
)
246+
);
247+
}
248+
catch (Exception $fallthrough)
249+
{
250+
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
251+
}
252+
}
253+
254+
/**
255+
* Operation mediaFilesSearchGet.
54256
*
55257
* Search for mediafiles associated with keywords
56258
*
57259
* @param Request $request the Symfony request to handle
58260
*
59261
* @return Response the Symfony response
60262
*/
61-
public function mediaFileSearchGetAction(Request $request)
263+
public function mediaFilesSearchGetAction(Request $request)
62264
{
63265
// Figure out what data format to return to the client
64266
$produces = ['application/json'];
@@ -143,7 +345,7 @@ public function mediaFileSearchGetAction(Request $request)
143345
// Make the call to the business logic
144346
$responseCode = 200;
145347
$responseHeaders = [];
146-
$result = $handler->mediaFileSearchGet($query_string, $flavor, $limit, $offset, $package_name, $responseCode, $responseHeaders);
348+
$result = $handler->mediaFilesSearchGet($query_string, $flavor, $limit, $offset, $package_name, $responseCode, $responseHeaders);
147349

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

Controller/ProjectsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/

Controller/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* API for the Catrobat Share Platform
1818
*
19-
* The version of the OpenAPI document: v1.0.37
19+
* The version of the OpenAPI document: v1.0.39
2020
* Contact: webmaster@catrobat.org
2121
* Generated by: https://github.com/openapitools/openapi-generator.git
2222
*/

0 commit comments

Comments
 (0)