|
16 | 16 | *
|
17 | 17 | * API for the Catrobat Share Platform
|
18 | 18 | *
|
19 |
| - * The version of the OpenAPI document: v1.1.20 |
| 19 | + * The version of the OpenAPI document: v1.2.0 |
20 | 20 |
|
21 | 21 | * Generated by: https://github.com/openapitools/openapi-generator.git
|
22 | 22 | */
|
@@ -598,6 +598,108 @@ public function userResetPasswordPostAction(Request $request)
|
598 | 598 | }
|
599 | 599 | }
|
600 | 600 |
|
| 601 | + /** |
| 602 | + * Operation usersGet. |
| 603 | + * |
| 604 | + * Get users |
| 605 | + * |
| 606 | + * @param Request $request the Symfony request to handle |
| 607 | + * |
| 608 | + * @return Response the Symfony response |
| 609 | + */ |
| 610 | + public function usersGetAction(Request $request) |
| 611 | + { |
| 612 | + // Figure out what data format to return to the client |
| 613 | + $produces = ['application/json']; |
| 614 | + // Figure out what the client accepts |
| 615 | + $clientAccepts = $request->headers->has('Accept') ? $request->headers->get('Accept') : '*/*'; |
| 616 | + $responseFormat = $this->getOutputFormat($clientAccepts, $produces); |
| 617 | + if (null === $responseFormat) { |
| 618 | + return new Response('', 406); |
| 619 | + } |
| 620 | + |
| 621 | + // Handle authentication |
| 622 | + |
| 623 | + // Read out all input parameter values into variables |
| 624 | + $query = $request->query->get('query'); |
| 625 | + $limit = $request->query->get('limit', 20); |
| 626 | + $offset = $request->query->get('offset', 0); |
| 627 | + |
| 628 | + // Use the default value if no value was provided |
| 629 | + |
| 630 | + // Deserialize the input values that needs it |
| 631 | + try { |
| 632 | + $query = $this->deserialize($query, 'string', 'string'); |
| 633 | + $limit = $this->deserialize($limit, 'int', 'string'); |
| 634 | + $offset = $this->deserialize($offset, 'int', 'string'); |
| 635 | + } catch (SerializerRuntimeException $exception) { |
| 636 | + return $this->createBadRequestResponse($exception->getMessage()); |
| 637 | + } |
| 638 | + |
| 639 | + // Validate the input values |
| 640 | + $asserts = []; |
| 641 | + $asserts[] = new Assert\NotNull(); |
| 642 | + $asserts[] = new Assert\Type('string'); |
| 643 | + $response = $this->validate($query, $asserts); |
| 644 | + if ($response instanceof Response) { |
| 645 | + return $response; |
| 646 | + } |
| 647 | + $asserts = []; |
| 648 | + $asserts[] = new Assert\Type('int'); |
| 649 | + $asserts[] = new Assert\GreaterThanOrEqual(0); |
| 650 | + $response = $this->validate($limit, $asserts); |
| 651 | + if ($response instanceof Response) { |
| 652 | + return $response; |
| 653 | + } |
| 654 | + $asserts = []; |
| 655 | + $asserts[] = new Assert\Type('int'); |
| 656 | + $asserts[] = new Assert\GreaterThanOrEqual(0); |
| 657 | + $response = $this->validate($offset, $asserts); |
| 658 | + if ($response instanceof Response) { |
| 659 | + return $response; |
| 660 | + } |
| 661 | + |
| 662 | + try { |
| 663 | + $handler = $this->getApiHandler(); |
| 664 | + |
| 665 | + // Make the call to the business logic |
| 666 | + $responseCode = 200; |
| 667 | + $responseHeaders = []; |
| 668 | + |
| 669 | + $result = $handler->usersGet($query, $limit, $offset, $responseCode, $responseHeaders); |
| 670 | + |
| 671 | + // Find default response message |
| 672 | + $message = ''; |
| 673 | + |
| 674 | + // Find a more specific message, if available |
| 675 | + switch ($responseCode) { |
| 676 | + case 200: |
| 677 | + $message = 'OK'; |
| 678 | + break; |
| 679 | + case 400: |
| 680 | + $message = 'Bad request (Invalid, or missing parameters)'; |
| 681 | + break; |
| 682 | + case 406: |
| 683 | + $message = 'Not acceptable - client must accept application/json as content type'; |
| 684 | + break; |
| 685 | + } |
| 686 | + |
| 687 | + return new Response( |
| 688 | + null !== $result ? $this->serialize($result, $responseFormat) : '', |
| 689 | + $responseCode, |
| 690 | + array_merge( |
| 691 | + $responseHeaders, |
| 692 | + [ |
| 693 | + 'Content-Type' => $responseFormat, |
| 694 | + 'X-OpenAPI-Message' => $message, |
| 695 | + ] |
| 696 | + ) |
| 697 | + ); |
| 698 | + } catch (\Throwable $fallthrough) { |
| 699 | + return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough)); |
| 700 | + } |
| 701 | + } |
| 702 | + |
601 | 703 | /**
|
602 | 704 | * Operation usersSearchGet.
|
603 | 705 | *
|
|
0 commit comments