diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml index 5a52f02..3ea3e7b 100644 --- a/config/api_platform/OgLive.yaml +++ b/config/api_platform/OgLive.yaml @@ -23,6 +23,60 @@ resources: ApiPlatform\Metadata\Post: ~ ApiPlatform\Metadata\Delete: ~ + get_collection: + shortName: OgLive Server + description: Get collection of OgLive + class: ApiPlatform\Metadata\Get + method: GET + input: false + uriTemplate: /og-lives/server/get-collection + controller: App\Controller\OgBoot\OgLive\GetCollectionAction + + get: + shortName: OgLive Server + description: Get OgLive + class: ApiPlatform\Metadata\Get + method: GET + input: false + uriTemplate: /og-lives/server/{uuid}/get + controller: App\Controller\OgBoot\OgLive\GetAction + + get_default: + shortName: OgLive Server + description: Get default OgLive + class: ApiPlatform\Metadata\Get + method: GET + input: false + uriTemplate: /og-lives/server/get-default + controller: App\Controller\OgBoot\OgLive\GetDefaultAction + + set_default: + shortName: OgLive Server + description: Set default OgLive + class: ApiPlatform\Metadata\Post + method: POST + input: false + uriTemplate: /og-lives/server/{uuid}/set-default + controller: App\Controller\OgBoot\OgLive\SetDefaultAction + + install: + shortName: OgLive Server + description: Install OgLive + class: ApiPlatform\Metadata\Post + method: POST + input: false + uriTemplate: /og-lives/server/{uuid}/install + controller: App\Controller\OgBoot\OgLive\InstallAction + + uninstall: + shortName: OgLive Server + description: Uninstall OgLive + class: ApiPlatform\Metadata\Get + method: GET + input: false + uriTemplate: /og-lives/server/{uuid}/uninstall + controller: App\Controller\OgBoot\OgLive\UninstallAction + properties: App\Entity\OgLive: id: diff --git a/src/Controller/OgBoot/OgBootController.php b/src/Controller/OgBoot/OgBootController.php new file mode 100644 index 0000000..100ab39 --- /dev/null +++ b/src/Controller/OgBoot/OgBootController.php @@ -0,0 +1,70 @@ +request('GET', 'https://api.example.com/ogboot/v1/status', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } + + + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws ClientExceptionInterface + */ + #[Route('/status', name: 'ogboot_config', methods: ['GET'])] + public function config(HttpClientInterface $httpClient): JsonResponse + { + try { + $response = $httpClient->request('GET', 'https://api.example.com/ogboot/v1/config', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} diff --git a/src/Controller/OgBoot/OgLive/GetAction.php b/src/Controller/OgBoot/OgLive/GetAction.php new file mode 100644 index 0000000..f0fcce6 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/GetAction.php @@ -0,0 +1,40 @@ +request('GET', 'https://api.example.com/ogboot/v1/oglives', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/GetCollectionAction.php b/src/Controller/OgBoot/OgLive/GetCollectionAction.php new file mode 100644 index 0000000..cdcaca0 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/GetCollectionAction.php @@ -0,0 +1,38 @@ +request('GET', 'https://api.example.com/ogboot/v1/oglives', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/GetDefaultAction.php b/src/Controller/OgBoot/OgLive/GetDefaultAction.php new file mode 100644 index 0000000..34f86e5 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/GetDefaultAction.php @@ -0,0 +1,40 @@ +request('GET', 'https://api.example.com/ogboot/v1/oglives/default', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php new file mode 100644 index 0000000..bea4132 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -0,0 +1,40 @@ +request('POST', 'https://api.example.com/ogboot/v1/oglives', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/SetDefaultAction.php b/src/Controller/OgBoot/OgLive/SetDefaultAction.php new file mode 100644 index 0000000..373c8ec --- /dev/null +++ b/src/Controller/OgBoot/OgLive/SetDefaultAction.php @@ -0,0 +1,40 @@ +request('POST', 'https://api.example.com/ogboot/v1/oglives/default', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/UninstallAction.php b/src/Controller/OgBoot/OgLive/UninstallAction.php new file mode 100644 index 0000000..2c2fde1 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/UninstallAction.php @@ -0,0 +1,40 @@ +request('DELETE', 'https://api.example.com/ogboot/v1/oglives', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Service/OgBoot/StatusService.php b/src/Service/OgBoot/StatusService.php new file mode 100644 index 0000000..d4621b3 --- /dev/null +++ b/src/Service/OgBoot/StatusService.php @@ -0,0 +1,8 @@ +