Part 1 of OpenAPI transition to Attributes.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-12-12 05:01:53 -06:00
parent c2d97a1a36
commit 8042fa9025
No known key found for this signature in database
GPG Key ID: 0FFEF642C60EFD9E
29 changed files with 2183 additions and 1952 deletions

View File

@ -89,7 +89,7 @@
"theiconic/php-ga-measurement-protocol": "^2.9", "theiconic/php-ga-measurement-protocol": "^2.9",
"vlucas/phpdotenv": "^5.3", "vlucas/phpdotenv": "^5.3",
"wikimedia/composer-merge-plugin": "dev-master", "wikimedia/composer-merge-plugin": "dev-master",
"zircote/swagger-php": "^3" "zircote/swagger-php": "^4"
}, },
"replace": { "replace": {
"symfony/polyfill-iconv": "1.99", "symfony/polyfill-iconv": "1.99",

28
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "2ab6f2e1f9e83b7c445c88755f0ae8de", "content-hash": "0e9f976588b4012a62481a6e95a806e1",
"packages": [ "packages": [
{ {
"name": "aws/aws-crt-php", "name": "aws/aws-crt-php",
@ -9779,28 +9779,28 @@
}, },
{ {
"name": "zircote/swagger-php", "name": "zircote/swagger-php",
"version": "3.3.2", "version": "4.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zircote/swagger-php.git", "url": "https://github.com/zircote/swagger-php.git",
"reference": "68c76ce2bb43fb4603315fb973d4595711dcbfd3" "reference": "c24704d90fbd296f889744d8da92c67653baef14"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/68c76ce2bb43fb4603315fb973d4595711dcbfd3", "url": "https://api.github.com/repos/zircote/swagger-php/zipball/c24704d90fbd296f889744d8da92c67653baef14",
"reference": "68c76ce2bb43fb4603315fb973d4595711dcbfd3", "reference": "c24704d90fbd296f889744d8da92c67653baef14",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/annotations": "^1.7", "doctrine/annotations": "^1.7",
"ext-json": "*", "ext-json": "*",
"php": ">=7.2", "php": ">=7.2",
"psr/log": "^1.1", "psr/log": "^1.1 || ^2.0 || 3.0",
"symfony/finder": ">=2.2", "symfony/finder": ">=2.2",
"symfony/yaml": ">=3.3" "symfony/yaml": ">=3.3"
}, },
"require-dev": { "require-dev": {
"composer/package-versions-deprecated": "1.11.99.2", "composer/package-versions-deprecated": "^1.11",
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0", "friendsofphp/php-cs-fixer": "^2.17 || ^3.0",
"phpunit/phpunit": ">=8" "phpunit/phpunit": ">=8"
}, },
@ -9808,13 +9808,15 @@
"bin/openapi" "bin/openapi"
], ],
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"OpenApi\\": "src" "OpenApi\\": "src"
}, }
"files": [
"src/functions.php"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -9846,9 +9848,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/zircote/swagger-php/issues", "issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/3.3.2" "source": "https://github.com/zircote/swagger-php/tree/4.0.4"
}, },
"time": "2021-11-15T20:45:42+00:00" "time": "2021-12-10T03:33:50+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

View File

@ -7,9 +7,11 @@ namespace App\Console\Command;
use App\Console\Application; use App\Console\Application;
use App\Environment; use App\Environment;
use App\Version; use App\Version;
use Monolog\Logger;
use OpenApi\Annotations\OpenApi; use OpenApi\Annotations\OpenApi;
use OpenApi\Generator; use OpenApi\Generator;
use OpenApi\Util; use OpenApi\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
class GenerateApiDocsCommand extends CommandAbstract class GenerateApiDocsCommand extends CommandAbstract
@ -17,7 +19,8 @@ class GenerateApiDocsCommand extends CommandAbstract
public function __construct( public function __construct(
Application $application, Application $application,
protected Environment $environment, protected Environment $environment,
protected Version $version protected Version $version,
protected LoggerInterface $logger
) { ) {
parent::__construct($application); parent::__construct($application);
} }
@ -57,6 +60,8 @@ class GenerateApiDocsCommand extends CommandAbstract
] ]
); );
return Generator::scan($finder); return Generator::scan($finder, [
'logger' => $this->logger
]);
} }
} }

View File

@ -8,88 +8,92 @@ use App\Entity;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
/** /**
* @OA\Get(path="/admin/custom_fields",
* operationId="getCustomFields",
* tags={"Administration: Custom Fields"},
* description="List all current custom fields in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/CustomField"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/custom_fields",
* operationId="addCustomField",
* tags={"Administration: Custom Fields"},
* description="Create a new custom field.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/custom_field/{id}",
* operationId="getCustomField",
* tags={"Administration: Custom Fields"},
* description="Retrieve details for a single custom field.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/custom_field/{id}",
* operationId="editCustomField",
* tags={"Administration: Custom Fields"},
* description="Update details of a single custom field.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/custom_field/{id}",
* operationId="deleteCustomField",
* tags={"Administration: Custom Fields"},
* description="Delete a single custom field.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractAdminApiCrudController<Entity\CustomField> * @extends AbstractAdminApiCrudController<Entity\CustomField>
*/ */
class CustomFieldsController extends AbstractAdminApiCrudController class CustomFieldsController extends AbstractAdminApiCrudController
{ {
protected string $entityClass = Entity\CustomField::class; protected string $entityClass = Entity\CustomField::class;
protected string $resourceRouteName = 'api:admin:custom_field'; protected string $resourceRouteName = 'api:admin:custom_field';
/**
* @OA\Get(path="/admin/custom_fields",
* tags={"Administration: Custom Fields"},
* description="List all current custom fields in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/CustomField"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/custom_fields",
* tags={"Administration: Custom Fields"},
* description="Create a new custom field.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/custom_field/{id}",
* tags={"Administration: Custom Fields"},
* description="Retrieve details for a single custom field.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/custom_field/{id}",
* tags={"Administration: Custom Fields"},
* description="Update details of a single custom field.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/CustomField")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
* @OA\Delete(path="/admin/custom_field/{id}",
* tags={"Administration: Custom Fields"},
* description="Delete a single custom field.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
} }

View File

@ -10,23 +10,21 @@ use App\Http\ServerRequest;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/admin/permissions",
* operationId="getPermissions",
* tags={"Administration: Roles"},
* description="Return a list of all available permissions.",
* @OA\Response(
* response=200,
* description="Success",
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
class PermissionsController class PermissionsController
{ {
/**
* @OA\Get(path="/admin/permissions",
* tags={"Administration: Roles"},
* description="Return a list of all available permissions.",
* @OA\Response(
* response=200,
* description="Success",
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @param ServerRequest $request
* @param Response $response
*/
public function __invoke( public function __invoke(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -13,6 +13,19 @@ use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/internal/relays",
* operationId="internalGetRelayDetails",
* tags={"Administration: Relays"},
* description="Returns all necessary information to relay all 'relayable' stations.",
* parameters={},
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Admin_Relay"))
* )
* )
*/
class RelaysController class RelaysController
{ {
public function __construct( public function __construct(
@ -21,21 +34,6 @@ class RelaysController
) { ) {
} }
/**
* @OA\Get(path="/internal/relays",
* tags={"Administration: Relays"},
* description="Returns all necessary information to relay all 'relayable' stations.",
* parameters={},
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Admin_Relay"))
* )
* )
*
* @param ServerRequest $request
* @param Response $response
*/
public function __invoke(ServerRequest $request, Response $response): ResponseInterface public function __invoke(ServerRequest $request, Response $response): ResponseInterface
{ {
$stations = $this->getManageableStations($request); $stations = $this->getManageableStations($request);

View File

@ -15,6 +15,88 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/admin/roles",
* operationId="getRoles",
* tags={"Administration: Roles"},
* description="List all current roles in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Role"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/roles",
* operationId="addRole",
* tags={"Administration: Roles"},
* description="Create a new role.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/role/{id}",
* operationId="getRole",
* tags={"Administration: Roles"},
* description="Retrieve details for a single current role.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/role/{id}",
* operationId="editRole",
* tags={"Administration: Roles"},
* description="Update details of a single role.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/role/{id}",
* operationId="deleteRole",
* tags={"Administration: Roles"},
* description="Delete a single role.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractAdminApiCrudController<Entity\Role> * @extends AbstractAdminApiCrudController<Entity\Role>
*/ */
class RolesController extends AbstractAdminApiCrudController class RolesController extends AbstractAdminApiCrudController
@ -32,87 +114,6 @@ class RolesController extends AbstractAdminApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/admin/roles",
* tags={"Administration: Roles"},
* description="List all current roles in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Role"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/roles",
* tags={"Administration: Roles"},
* description="Create a new role.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/role/{id}",
* tags={"Administration: Roles"},
* description="Retrieve details for a single current role.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/role/{id}",
* tags={"Administration: Roles"},
* description="Update details of a single role.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Role")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/role/{id}",
* tags={"Administration: Roles"},
* description="Delete a single role.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Role ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @inheritdoc
*/
protected function deleteRecord(object $record): void protected function deleteRecord(object $record): void
{ {
if (!($record instanceof Entity\Role)) { if (!($record instanceof Entity\Role)) {

View File

@ -7,7 +7,6 @@ namespace App\Controller\Api\Admin;
use App\Controller\Api\AbstractApiCrudController; use App\Controller\Api\AbstractApiCrudController;
use App\Doctrine\ReloadableEntityManagerInterface; use App\Doctrine\ReloadableEntityManagerInterface;
use App\Entity; use App\Entity;
use App\Exception\ValidationException;
use App\Http\Response; use App\Http\Response;
use App\Http\ServerRequest; use App\Http\ServerRequest;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
@ -17,6 +16,31 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/admin/settings",
* operationId="getSettings",
* tags={"Administration: Settings"},
* description="List the current values of all editable system settings.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Settings")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/settings",
* operationId="editSettings",
* tags={"Administration: Settings"},
* description="Update settings to modify any settings provided.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Settings")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractApiCrudController<Entity\Settings> * @extends AbstractApiCrudController<Entity\Settings>
*/ */
class SettingsController extends AbstractApiCrudController class SettingsController extends AbstractApiCrudController
@ -32,20 +56,6 @@ class SettingsController extends AbstractApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/admin/settings",
* tags={"Administration: Settings"},
* description="List the current values of all editable system settings.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Settings")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @param ServerRequest $request
* @param Response $response
*/
public function listAction( public function listAction(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,
@ -60,25 +70,6 @@ class SettingsController extends AbstractApiCrudController
return $response->withJson($this->toArray($settings, $context)); return $response->withJson($this->toArray($settings, $context));
} }
/**
* @OA\Put(path="/admin/settings",
* tags={"Administration: Settings"},
* description="Update settings to modify any settings provided.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Settings")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @param ServerRequest $request
* @param Response $response
*
* @throws ValidationException
*/
public function updateAction( public function updateAction(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -18,6 +18,88 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/admin/stations",
* operationId="adminGetStations",
* tags={"Administration: Stations"},
* description="List all current stations in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Station"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/stations",
* operationId="adminAddStation",
* tags={"Administration: Stations"},
* description="Create a new station.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/station/{id}",
* operationId="adminGetStation",
* tags={"Administration: Stations"},
* description="Retrieve details for a single station.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/station/{id}",
* operationId="adminEditStation",
* tags={"Administration: Stations"},
* description="Update details of a single station.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/station/{id}",
* operationId="adminDeleteStation",
* tags={"Administration: Stations"},
* description="Delete a single station.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractAdminApiCrudController<Entity\Station> * @extends AbstractAdminApiCrudController<Entity\Station>
*/ */
class StationsController extends AbstractAdminApiCrudController class StationsController extends AbstractAdminApiCrudController
@ -37,85 +119,6 @@ class StationsController extends AbstractAdminApiCrudController
parent::__construct($reloadableEm, $serializer, $validator); parent::__construct($reloadableEm, $serializer, $validator);
} }
/**
* @OA\Get(path="/admin/stations",
* tags={"Administration: Stations"},
* description="List all current stations in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Station"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/stations",
* tags={"Administration: Stations"},
* description="Create a new station.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/station/{id}",
* tags={"Administration: Stations"},
* description="Retrieve details for a single station.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/station/{id}",
* tags={"Administration: Stations"},
* description="Update details of a single station.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Station")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/station/{id}",
* tags={"Administration: Stations"},
* description="Delete a single station.",
* @OA\Parameter(
* name="id",
* in="path",
* description="ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
protected function viewRecord(object $record, ServerRequest $request): mixed protected function viewRecord(object $record, ServerRequest $request): mixed
{ {
if (!($record instanceof $this->entityClass)) { if (!($record instanceof $this->entityClass)) {

View File

@ -16,6 +16,88 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/admin/storage_locations",
* operationId="getStorageLocations",
* tags={"Administration: Storage Locations"},
* description="List all current storage locations in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Admin_StorageLocation"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/storage_locations",
* operationId="addStorageLocation",
* tags={"Administration: Storage Locations"},
* description="Create a new storage location.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/storage_location/{id}",
* operationId="getStorageLocation",
* tags={"Administration: Storage Locations"},
* description="Retrieve details for a single storage location.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/storage_location/{id}",
* operationId="editStorageLocation",
* tags={"Administration: Storage Locations"},
* description="Update details of a single storage location.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Storage Location ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/storage_location/{id}",
* operationId="deleteStorageLocation",
* tags={"Administration: Storage Locations"},
* description="Delete a single storage location.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Storage Location ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractAdminApiCrudController<Entity\StorageLocation> * @extends AbstractAdminApiCrudController<Entity\StorageLocation>
*/ */
class StorageLocationsController extends AbstractAdminApiCrudController class StorageLocationsController extends AbstractAdminApiCrudController
@ -32,85 +114,6 @@ class StorageLocationsController extends AbstractAdminApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/admin/storage_locations",
* tags={"Administration: Storage Locations"},
* description="List all current storage locations in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Admin_StorageLocation"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/storage_locations",
* tags={"Administration: Storage Locations"},
* description="Create a new storage location.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/storage_location/{id}",
* tags={"Administration: Storage Locations"},
* description="Retrieve details for a single storage location.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/storage_location/{id}",
* tags={"Administration: Storage Locations"},
* description="Update details of a single storage location.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Admin_StorageLocation")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Storage Location ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/storage_location/{id}",
* tags={"Administration: Storage Locations"},
* description="Delete a single storage location.",
* @OA\Parameter(
* name="id",
* in="path",
* description="Storage Location ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
public function listAction(ServerRequest $request, Response $response): ResponseInterface public function listAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$qb = $this->em->createQueryBuilder(); $qb = $this->em->createQueryBuilder();

View File

@ -13,6 +13,88 @@ use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/** /**
* @OA\Get(path="/admin/users",
* operationId="getUsers",
* tags={"Administration: Users"},
* description="List all current users in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/User"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/users",
* operationId="addUser",
* tags={"Administration: Users"},
* description="Create a new user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/user/{id}",
* operationId="getUser",
* tags={"Administration: Users"},
* description="Retrieve details for a single current user.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/user/{id}",
* operationId="editUser",
* tags={"Administration: Users"},
* description="Update details of a single user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/admin/user/{id}",
* operationId="deleteUser",
* tags={"Administration: Users"},
* description="Delete a single user.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractAdminApiCrudController<Entity\User> * @extends AbstractAdminApiCrudController<Entity\User>
*/ */
class UsersController extends AbstractAdminApiCrudController class UsersController extends AbstractAdminApiCrudController
@ -20,68 +102,6 @@ class UsersController extends AbstractAdminApiCrudController
protected string $entityClass = Entity\User::class; protected string $entityClass = Entity\User::class;
protected string $resourceRouteName = 'api:admin:user'; protected string $resourceRouteName = 'api:admin:user';
/**
* @OA\Get(path="/admin/users",
* tags={"Administration: Users"},
* description="List all current users in the system.",
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/User"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/admin/users",
* tags={"Administration: Users"},
* description="Create a new user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/admin/user/{id}",
* tags={"Administration: Users"},
* description="Retrieve details for a single current user.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/admin/user/{id}",
* tags={"Administration: Users"},
* description="Update details of a single user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/User")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
protected function viewRecord(object $record, ServerRequest $request): mixed protected function viewRecord(object $record, ServerRequest $request): mixed
{ {
if (!($record instanceof Entity\User)) { if (!($record instanceof Entity\User)) {
@ -136,26 +156,6 @@ class UsersController extends AbstractAdminApiCrudController
return $response->withJson(Entity\Api\Status::updated()); return $response->withJson(Entity\Api\Status::updated());
} }
/**
* @OA\Delete(path="/admin/user/{id}",
* tags={"Administration: Users"},
* description="Delete a single user.",
* @OA\Parameter(
* name="id",
* in="path",
* description="User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @inheritdoc
*/
public function deleteAction(ServerRequest $request, Response $response, mixed $id): ResponseInterface public function deleteAction(ServerRequest $request, Response $response, mixed $id): ResponseInterface
{ {
$record = $this->getRecord($id); $record = $this->getRecord($id);

View File

@ -22,6 +22,93 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/station/{station_id}/files",
* operationId="getFiles",
* tags={"Stations: Media"},
* description="List all current uploaded files.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationMedia"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/files",
* operationId="addFile",
* tags={"Stations: Media"},
* description="Upload a new file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_UploadFile")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/file/{id}",
* operationId="getFile",
* tags={"Stations: Media"},
* description="Retrieve details for a single file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/file/{id}",
* operationId="editFile",
* tags={"Stations: Media"},
* description="Update details of a single file.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/file/{id}",
* operationId="deleteFile",
* tags={"Stations: Media"},
* description="Delete a single file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractStationApiCrudController<Entity\StationMedia> * @extends AbstractStationApiCrudController<Entity\StationMedia>
*/ */
class FilesController extends AbstractStationApiCrudController class FilesController extends AbstractStationApiCrudController
@ -42,95 +129,6 @@ class FilesController extends AbstractStationApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/station/{station_id}/files",
* tags={"Stations: Media"},
* description="List all current uploaded files.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationMedia"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/files",
* tags={"Stations: Media"},
* description="Upload a new file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_UploadFile")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/file/{id}",
* tags={"Stations: Media"},
* description="Retrieve details for a single file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/file/{id}",
* tags={"Stations: Media"},
* description="Update details of a single file.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMedia")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/file/{id}",
* tags={"Stations: Media"},
* description="Delete a single file.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Media ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
/**
* @param ServerRequest $request
* @param Response $response
*
*/
public function listAction(ServerRequest $request, Response $response): ResponseInterface public function listAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$storageLocation = $this->getStation($request)->getMediaStorageLocation(); $storageLocation = $this->getStation($request)->getMediaStorageLocation();

View File

@ -15,6 +15,40 @@ use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/station/{station_id}/history",
* operationId="getStationHistory",
* tags={"Stations: History"},
* description="Return song playback history items for a given station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="start",
* description="The start date for records, in YYYY-MM-DD format.",
* in="query",
* required=false,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Parameter(
* name="end",
* description="The end date for records, in YYYY-MM-DD format.",
* in="query",
* required=false,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_DetailedSongHistory"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
class HistoryController class HistoryController
{ {
public function __construct( public function __construct(
@ -24,38 +58,6 @@ class HistoryController
} }
/** /**
* @OA\Get(path="/station/{station_id}/history",
* tags={"Stations: History"},
* description="Return song playback history items for a given station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="start",
* description="The start date for records, in YYYY-MM-DD format.",
* in="query",
* required=false,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Parameter(
* name="end",
* description="The end date for records, in YYYY-MM-DD format.",
* in="query",
* required=false,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_DetailedSongHistory"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @param ServerRequest $request * @param ServerRequest $request
* @param Response $response * @param Response $response
*/ */

View File

@ -5,14 +5,36 @@ declare(strict_types=1);
namespace App\Controller\Api\Stations; namespace App\Controller\Api\Stations;
use App\Entity; use App\Entity;
use App\Exception;
use App\Exception\NotFoundException;
use App\Http\Response; use App\Http\Response;
use App\Http\ServerRequest; use App\Http\ServerRequest;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/stations",
* operationId="getStations",
* tags={"Stations: General"},
* description="Returns a list of stations.",
* parameters={},
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array",
* @OA\Items(ref="#/components/schemas/Api_NowPlaying_Station")
* )
* )
* )
*
* @OA\Get(path="/station/{station_id}",
* operationId="getStation",
* tags={"Stations: General"},
* description="Return information about a single station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_NowPlaying_Station")
* ),
* @OA\Response(response=404, description="Station not found")
* )
*/
class IndexController class IndexController
{ {
public function __construct( public function __construct(
@ -21,23 +43,6 @@ class IndexController
) { ) {
} }
/**
* @OA\Get(path="/stations",
* tags={"Stations: General"},
* description="Returns a list of stations.",
* parameters={},
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array",
* @OA\Items(ref="#/components/schemas/Api_NowPlaying_Station")
* )
* )
* )
* @param ServerRequest $request
* @param Response $response
*
* @throws NotFoundException
* @throws Exception
*/
public function listAction(ServerRequest $request, Response $response): ResponseInterface public function listAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$stations_raw = $this->em->getRepository(Entity\Station::class) $stations_raw = $this->em->getRepository(Entity\Station::class)
@ -57,21 +62,6 @@ class IndexController
return $response->withJson($stations); return $response->withJson($stations);
} }
/**
* @OA\Get(path="/station/{station_id}",
* tags={"Stations: General"},
* description="Return information about a single station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_NowPlaying_Station")
* ),
* @OA\Response(response=404, description="Station not found")
* )
* @param ServerRequest $request
* @param Response $response
*
* @throws Exception
*/
public function indexAction(ServerRequest $request, Response $response): ResponseInterface public function indexAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();

View File

@ -20,23 +20,24 @@ use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use RuntimeException; use RuntimeException;
/**
* @OA\Get(path="/station/{station_id}/listeners",
* operationId="getStationListeners",
* tags={"Stations: Listeners"},
* description="Return detailed information about current listeners.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Listener"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
class ListenersAction class ListenersAction
{ {
/**
* @OA\Get(path="/station/{station_id}/listeners",
* tags={"Stations: Listeners"},
* description="Return detailed information about current listeners.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Listener"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
public function __invoke( public function __invoke(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -17,6 +17,93 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/station/{station_id}/mounts",
* operationId="getStationMounts",
* tags={"Stations: Mount Points"},
* description="List all current mount points.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationMount"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/mounts",
* operationId="addMount",
* tags={"Stations: Mount Points"},
* description="Create a new mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/mount/{id}",
* operationId="getMount",
* tags={"Stations: Mount Points"},
* description="Retrieve details for a single mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/mount/{id}",
* operationId="editMount",
* tags={"Stations: Mount Points"},
* description="Update details of a single mount point.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/mount/{id}",
* operationId="deleteMount",
* tags={"Stations: Mount Points"},
* description="Delete a single mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="StationMount ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractStationApiCrudController<Entity\StationMount> * @extends AbstractStationApiCrudController<Entity\StationMount>
*/ */
class MountsController extends AbstractStationApiCrudController class MountsController extends AbstractStationApiCrudController
@ -33,90 +120,6 @@ class MountsController extends AbstractStationApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/station/{station_id}/mounts",
* tags={"Stations: Mount Points"},
* description="List all current mount points.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationMount"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/mounts",
* tags={"Stations: Mount Points"},
* description="Create a new mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/mount/{id}",
* tags={"Stations: Mount Points"},
* description="Retrieve details for a single mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/mount/{id}",
* tags={"Stations: Mount Points"},
* description="Update details of a single mount point.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationMount")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/mount/{id}",
* tags={"Stations: Mount Points"},
* description="Delete a single mount point.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="StationMount ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
protected function viewRecord(object $record, ServerRequest $request): mixed protected function viewRecord(object $record, ServerRequest $request): mixed
{ {
/** @var Entity\StationMount $record */ /** @var Entity\StationMount $record */

View File

@ -14,6 +14,93 @@ use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
/** /**
* @OA\Get(path="/station/{station_id}/playlists",
* operationId="getPlaylists",
* tags={"Stations: Playlists"},
* description="List all current playlists.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationPlaylist"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/playlists",
* operationId="addPlaylist",
* tags={"Stations: Playlists"},
* description="Create a new playlist.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/playlist/{id}",
* operationId="getPlaylist",
* tags={"Stations: Playlists"},
* description="Retrieve details for a single playlist.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/playlist/{id}",
* operationId="editPlaylist",
* tags={"Stations: Playlists"},
* description="Update details of a single playlist.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/playlist/{id}",
* operationId="deletePlaylist",
* tags={"Stations: Playlists"},
* description="Delete a single playlist relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractScheduledEntityController<Entity\StationPlaylist> * @extends AbstractScheduledEntityController<Entity\StationPlaylist>
*/ */
class PlaylistsController extends AbstractScheduledEntityController class PlaylistsController extends AbstractScheduledEntityController
@ -21,90 +108,6 @@ class PlaylistsController extends AbstractScheduledEntityController
protected string $entityClass = Entity\StationPlaylist::class; protected string $entityClass = Entity\StationPlaylist::class;
protected string $resourceRouteName = 'api:stations:playlist'; protected string $resourceRouteName = 'api:stations:playlist';
/**
* @OA\Get(path="/station/{station_id}/playlists",
* tags={"Stations: Playlists"},
* description="List all current playlists.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationPlaylist"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/playlists",
* tags={"Stations: Playlists"},
* description="Create a new playlist.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/playlist/{id}",
* tags={"Stations: Playlists"},
* description="Retrieve details for a single playlist.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/playlist/{id}",
* tags={"Stations: Playlists"},
* description="Update details of a single playlist.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationPlaylist")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/playlist/{id}",
* tags={"Stations: Playlists"},
* description="Delete a single playlist relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Playlist ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
/** /**
* @inheritDoc * @inheritDoc
*/ */

View File

@ -13,12 +13,135 @@ use App\Http\Response;
use App\Http\ServerRequest; use App\Http\ServerRequest;
use App\Service\Flow\UploadedFile; use App\Service\Flow\UploadedFile;
use InvalidArgumentException; use InvalidArgumentException;
use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use RuntimeException; use RuntimeException;
use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/station/{station_id}/podcast/{podcast_id}/episodes",
* operationId="getEpisodes",
* tags={"Stations: Podcasts"},
* description="List all current episodes for a given podcast ID.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_PodcastEpisode"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/podcast/{podcast_id}/episodes",
* operationId="addEpisode",
* tags={"Stations: Podcasts"},
* description="Create a new podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* operationId="getEpisode",
* tags={"Stations: Podcasts"},
* description="Retrieve details for a single podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* operationId="editEpisode",
* tags={"Stations: Podcasts"},
* description="Update details of a single podcast episode.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* operationId="deleteEpisode",
* tags={"Stations: Podcasts"},
* description="Delete a single podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractApiCrudController<Entity\PodcastEpisode> * @extends AbstractApiCrudController<Entity\PodcastEpisode>
*/ */
class PodcastEpisodesController extends AbstractApiCrudController class PodcastEpisodesController extends AbstractApiCrudController
@ -37,125 +160,6 @@ class PodcastEpisodesController extends AbstractApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/station/{station_id}/podcast/{podcast_id}/episodes",
* tags={"Stations: Podcasts"},
* description="List all current episodes for a given podcast ID.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_PodcastEpisode"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/podcast/{podcast_id}/episodes",
* tags={"Stations: Podcasts"},
* description="Create a new podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* tags={"Stations: Podcasts"},
* description="Retrieve details for a single podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* tags={"Stations: Podcasts"},
* description="Update details of a single podcast episode.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_PodcastEpisode")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/podcast/{podcast_id}/episode/{id}",
* tags={"Stations: Podcasts"},
* description="Delete a single podcast episode.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="podcast_id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast Episode ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
public function listAction( public function listAction(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -20,6 +20,93 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/station/{station_id}/podcasts",
* operationId="getPodcasts",
* tags={"Stations: Podcasts"},
* description="List all current podcasts.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Podcast"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/podcasts",
* operationId="addPodcast",
* tags={"Stations: Podcasts"},
* description="Create a new podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/podcast/{id}",
* operationId="getPodcast",
* tags={"Stations: Podcasts"},
* description="Retrieve details for a single podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/podcast/{id}",
* operationId="editPodcast",
* tags={"Stations: Podcasts"},
* description="Update details of a single podcast.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/podcast/{id}",
* operationId="deletePodcast",
* tags={"Stations: Podcasts"},
* description="Delete a single podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractApiCrudController<Entity\Podcast> * @extends AbstractApiCrudController<Entity\Podcast>
*/ */
class PodcastsController extends AbstractApiCrudController class PodcastsController extends AbstractApiCrudController
@ -37,93 +124,6 @@ class PodcastsController extends AbstractApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/station/{station_id}/podcasts",
* tags={"Stations: Podcasts"},
* description="List all current podcasts.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_Podcast"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/podcasts",
* tags={"Stations: Podcasts"},
* description="Create a new podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/podcast/{id}",
* tags={"Stations: Podcasts"},
* description="Retrieve details for a single podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/podcast/{id}",
* tags={"Stations: Podcasts"},
* description="Update details of a single podcast.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_Podcast")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/podcast/{id}",
* tags={"Stations: Podcasts"},
* description="Delete a single podcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Podcast ID",
* required=true,
* @OA\Schema(type="string")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
/**
* @inheritDoc
*/
public function listAction(ServerRequest $request, Response $response): ResponseInterface public function listAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();

View File

@ -15,6 +15,61 @@ use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
/** /**
* @OA\Get(path="/station/{station_id}/queue",
* operationId="getQueue",
* tags={"Stations: Queue"},
* description="Return information about the upcoming song playback queue.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array",
* @OA\Items(ref="#/components/schemas/Api_StationQueueDetailed")
* )
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*
* @OA\Get(path="/station/{station_id}/queue/{id}",
* operationId="getQueueItem",
* tags={"Stations: Queue"},
* description="Retrieve details of a single queued item.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Queue Item ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationQueueDetailed")
* ),
* @OA\Response(response=404, description="Station or Queue ID not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*
* @OA\Delete(path="/station/{station_id}/queue/{id}",
* operationId="deleteQueueItem",
* tags={"Stations: Queue"},
* description="Delete a single queued item.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Queue Item ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=404, description="Station or Queue ID not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*
* @extends AbstractStationApiCrudController<Entity\StationQueue> * @extends AbstractStationApiCrudController<Entity\StationQueue>
*/ */
class QueueController extends AbstractStationApiCrudController class QueueController extends AbstractStationApiCrudController
@ -32,23 +87,6 @@ class QueueController extends AbstractStationApiCrudController
parent::__construct($em, $serializer, $validator); parent::__construct($em, $serializer, $validator);
} }
/**
* @OA\Get(path="/station/{station_id}/queue",
* tags={"Stations: Queue"},
* description="Return information about the upcoming song playback queue.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array",
* @OA\Items(ref="#/components/schemas/Api_StationQueueDetailed")
* )
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*
* @inheritdoc
*/
public function listAction( public function listAction(
ServerRequest $request, ServerRequest $request,
Response $response Response $response
@ -63,46 +101,6 @@ class QueueController extends AbstractStationApiCrudController
); );
} }
/**
* @OA\Get(path="/station/{station_id}/queue/{id}",
* tags={"Stations: Queue"},
* description="Retrieve details of a single queued item.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Queue Item ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationQueueDetailed")
* ),
* @OA\Response(response=404, description="Station or Queue ID not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*
* @OA\Delete(path="/station/{station_id}/queue/{id}",
* tags={"Stations: Queue"},
* description="Delete a single queued item.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Queue Item ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=404, description="Station or Queue ID not found"),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}}
* )
*/
/** /**
* @param object $record * @param object $record
* @param ServerRequest $request * @param ServerRequest $request

View File

@ -11,6 +11,93 @@ use InvalidArgumentException;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
/** /**
* @OA\Get(path="/station/{station_id}/remotes",
* operationId="getRelays",
* tags={"Stations: Remote Relays"},
* description="List all current remote relays.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_StationRemote"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/remotes",
* operationId="addRelay",
* tags={"Stations: Remote Relays"},
* description="Create a new remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/remote/{id}",
* operationId="getRelay",
* tags={"Stations: Remote Relays"},
* description="Retrieve details for a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/remote/{id}",
* operationId="editRelay",
* tags={"Stations: Remote Relays"},
* description="Update details of a single remote relay.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/remote/{id}",
* operationId="deleteRelay",
* tags={"Stations: Remote Relays"},
* description="Delete a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractStationApiCrudController<Entity\StationRemote> * @extends AbstractStationApiCrudController<Entity\StationRemote>
*/ */
class RemotesController extends AbstractStationApiCrudController class RemotesController extends AbstractStationApiCrudController
@ -18,90 +105,6 @@ class RemotesController extends AbstractStationApiCrudController
protected string $entityClass = Entity\StationRemote::class; protected string $entityClass = Entity\StationRemote::class;
protected string $resourceRouteName = 'api:stations:remote'; protected string $resourceRouteName = 'api:stations:remote';
/**
* @OA\Get(path="/station/{station_id}/remotes",
* tags={"Stations: Remote Relays"},
* description="List all current remote relays.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_StationRemote"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/remotes",
* tags={"Stations: Remote Relays"},
* description="Create a new remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/remote/{id}",
* tags={"Stations: Remote Relays"},
* description="Retrieve details for a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/remote/{id}",
* tags={"Stations: Remote Relays"},
* description="Update details of a single remote relay.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/Api_StationRemote")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/remote/{id}",
* tags={"Stations: Remote Relays"},
* description="Delete a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
protected function viewRecord(object $record, ServerRequest $request): mixed protected function viewRecord(object $record, ServerRequest $request): mixed
{ {
if (!($record instanceof Entity\StationRemote)) { if (!($record instanceof Entity\StationRemote)) {

View File

@ -14,6 +14,43 @@ use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/station/{station_id}/requests",
* operationId="getRequestableSongs",
* tags={"Stations: Song Requests"},
* description="Return a list of requestable songs.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\Schema(
* type="array",
* @OA\Items(ref="#/components/schemas/Api_StationRequest")
* )
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Station does not support requests")
* )
*
* @OA\Post(path="/station/{station_id}/request/{request_id}",
* operationId="submitSongRequest",
* tags={"Stations: Song Requests"},
* description="Submit a song request.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="request_id",
* description="The requestable song ID",
* in="path",
* required=true,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(response=200, description="Success"),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Station does not support requests")
* )
*/
class RequestsController class RequestsController
{ {
public function __construct( public function __construct(
@ -23,29 +60,6 @@ class RequestsController
) { ) {
} }
/**
* @OA\Get(path="/station/{station_id}/requests",
* tags={"Stations: Song Requests"},
* description="Return a list of requestable songs.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\Schema(
* type="array",
* @OA\Items(ref="#/components/schemas/Api_StationRequest")
* )
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Station does not support requests")
* )
*
* @param ServerRequest $request
* @param Response $response
*
* @throws Exception
* @throws Exception\InvalidRequestAttribute
*/
public function listAction(ServerRequest $request, Response $response): ResponseInterface public function listAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();
@ -125,31 +139,6 @@ class RequestsController
return $paginator->write($response); return $paginator->write($response);
} }
/**
* @OA\Post(path="/station/{station_id}/request/{request_id}",
* tags={"Stations: Song Requests"},
* description="Submit a song request.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="request_id",
* description="The requestable song ID",
* in="path",
* required=true,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(response=200, description="Success"),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Station does not support requests")
* )
*
* @param ServerRequest $request
* @param Response $response
* @param string $media_id
*
* @throws Exception\InvalidRequestAttribute
*/
public function submitAction(ServerRequest $request, Response $response, string $media_id): ResponseInterface public function submitAction(ServerRequest $request, Response $response, string $media_id): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();

View File

@ -16,39 +16,39 @@ use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Cache\CacheItem; use Symfony\Component\Cache\CacheItem;
use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\CacheInterface;
/**
* @OA\Get(path="/station/{station_id}/schedule",
* operationId="getSchedule",
* tags={"Stations: Schedules"},
* description="Return upcoming and currently ongoing schedule entries.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="now",
* description="The date/time to compare schedule items to. Defaults to the current date and time.",
* in="query",
* required=false,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="rows",
* description="The number of upcoming/ongoing schedule entries to return. Defaults to 5.",
* in="query",
* required=false,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_StationSchedule"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied")
* )
*/
class ScheduleAction class ScheduleAction
{ {
use HasScheduleDisplay; use HasScheduleDisplay;
/**
* @OA\Get(path="/station/{station_id}/schedule",
* tags={"Stations: Schedules"},
* description="Return upcoming and currently ongoing schedule entries.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="now",
* description="The date/time to compare schedule items to. Defaults to the current date and time.",
* in="query",
* required=false,
* @OA\Schema(type="string")
* ),
* @OA\Parameter(
* name="rows",
* description="The number of upcoming/ongoing schedule entries to return. Defaults to 5.",
* in="query",
* required=false,
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_StationSchedule"))
* ),
* @OA\Response(response=404, description="Station not found"),
* @OA\Response(response=403, description="Access denied")
* )
*/
public function __invoke( public function __invoke(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -15,6 +15,71 @@ use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/**
* @OA\Get(path="/station/{station_id}/status",
* operationId="getServiceStatus",
* tags={"Stations: Service Control"},
* description="Retrieve the current status of all serivces associated with the radio broadcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\Schema(ref="#/components/schemas/Api_StationServiceStatus")
* ),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @OA\Post(path="/station/{station_id}/restart",
* operationId="restartServices",
* tags={"Stations: Service Control"},
* description="Restart all services associated with the radio broadcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @OA\Post(path="/station/{station_id}/frontend/{action}",
* operationId="doFrontendServiceAction",
* tags={"Stations: Service Control"},
* description="Perform service control actions on the radio frontend (Icecast, SHOUTcast, etc.)",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="action",
* description="The action to perform (start, stop, restart)",
* in="path",
* required=false,
* @OA\Schema(
* type="string",
* default="restart"
* )
* ),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @OA\Post(path="/station/{station_id}/backend/{action}",
* operationId="doBackendServiceAction",
* tags={"Stations: Service Control"},
* description="Perform service control actions on the radio backend (Liquidsoap)",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="action",
* description="The action to perform (for all: start, stop, restart; for Liquidsoap only: skip, disconnect)",
* in="path",
* required=false,
* @OA\Schema(
* type="string",
* default="restart"
* )
* ),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*/
class ServicesController class ServicesController
{ {
public function __construct( public function __construct(
@ -23,23 +88,6 @@ class ServicesController
) { ) {
} }
/**
* @OA\Get(path="/station/{station_id}/status",
* tags={"Stations: Service Control"},
* description="Retrieve the current status of all serivces associated with the radio broadcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\Schema(ref="#/components/schemas/Api_StationServiceStatus")
* ),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @param ServerRequest $request
* @param Response $response
*/
public function statusAction(ServerRequest $request, Response $response): ResponseInterface public function statusAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();
@ -57,19 +105,6 @@ class ServicesController
); );
} }
/**
* @OA\Post(path="/station/{station_id}/restart",
* tags={"Stations: Service Control"},
* description="Restart all services associated with the radio broadcast.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @param ServerRequest $request
* @param Response $response
*/
public function restartAction(ServerRequest $request, Response $response): ResponseInterface public function restartAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();
@ -78,30 +113,6 @@ class ServicesController
return $response->withJson(new Entity\Api\Status(true, __('Station restarted.'))); return $response->withJson(new Entity\Api\Status(true, __('Station restarted.')));
} }
/**
* @OA\Post(path="/station/{station_id}/frontend/{action}",
* tags={"Stations: Service Control"},
* description="Perform service control actions on the radio frontend (Icecast, SHOUTcast, etc.)",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="action",
* description="The action to perform (start, stop, restart)",
* in="path",
* required=false,
* @OA\Schema(
* type="string",
* default="restart"
* )
* ),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @param ServerRequest $request
* @param Response $response
* @param string $do
*/
public function frontendAction( public function frontendAction(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,
@ -141,31 +152,6 @@ class ServicesController
} }
} }
/**
* @OA\Post(path="/station/{station_id}/backend/{action}",
* tags={"Stations: Service Control"},
* description="Perform service control actions on the radio backend (Liquidsoap)",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="action",
* description="The action to perform (for all: start, stop, restart; for Liquidsoap only: skip, disconnect)",
* in="path",
* required=false,
* @OA\Schema(
* type="string",
* default="restart"
* )
* ),
* @OA\Response(response=200, description="Success", @OA\Schema(ref="#/components/schemas/Api_Status")),
* @OA\Response(response=403, description="Access Forbidden", @OA\Schema(ref="#/components/schemas/Api_Error")),
* security={{"api_key": {}}}
* )
*
* @param ServerRequest $request
* @param Response $response
* @param AutoDJ $autodj
* @param string $do
*/
public function backendAction( public function backendAction(
ServerRequest $request, ServerRequest $request,
Response $response, Response $response,

View File

@ -8,94 +8,97 @@ use App\Entity;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
/** /**
* @OA\Get(path="/station/{station_id}/sftp-users",
* operationId="getSftpUsers",
* tags={"Stations: SFTP Users"},
* description="List all current SFTP users.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/SftpUser"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/sftp-users",
* operationId="addSftpUser",
* tags={"Stations: SFTP Users"},
* description="Create a new SFTP user.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/sftp-user/{id}",
* operationId="getSftpUser",
* tags={"Stations: SFTP Users"},
* description="Retrieve details for a single SFTP user.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="SFTP User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/sftp-user/{id}",
* operationId="editSftpUser",
* tags={"Stations: SFTP Users"},
* description="Update details of a single SFTP user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/sftp-user/{id}",
* operationId="deleteSftpUser",
* tags={"Stations: SFTP Users"},
* description="Delete a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractStationApiCrudController<Entity\SftpUser> * @extends AbstractStationApiCrudController<Entity\SftpUser>
*/ */
class SftpUsersController extends AbstractStationApiCrudController class SftpUsersController extends AbstractStationApiCrudController
{ {
protected string $entityClass = Entity\SftpUser::class; protected string $entityClass = Entity\SftpUser::class;
protected string $resourceRouteName = 'api:stations:sftp-user'; protected string $resourceRouteName = 'api:stations:sftp-user';
/**
* @OA\Get(path="/station/{station_id}/sftp-users",
* tags={"Stations: SFTP Users"},
* description="List all current SFTP users.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/SftpUser"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/sftp-users",
* tags={"Stations: SFTP Users"},
* description="Create a new SFTP user.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/sftp-user/{id}",
* tags={"Stations: SFTP Users"},
* description="Retrieve details for a single SFTP user.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="SFTP User ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/sftp-user/{id}",
* tags={"Stations: SFTP Users"},
* description="Update details of a single SFTP user.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/SftpUser")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/sftp-user/{id}",
* tags={"Stations: SFTP Users"},
* description="Delete a single remote relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Remote Relay ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
} }

View File

@ -13,6 +13,93 @@ use OpenApi\Annotations as OA;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
/** /**
* @OA\Get(path="/station/{station_id}/streamers",
* operationId="getStreamers",
* tags={"Stations: Streamers/DJs"},
* description="List all current Streamer/DJ accounts for the specified station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationStreamer"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/streamers",
* operationId="addStreamer",
* tags={"Stations: Streamers/DJs"},
* description="Create a new Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/streamer/{id}",
* operationId="getStreamer",
* tags={"Stations: Streamers/DJs"},
* description="Retrieve details for a single Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/streamer/{id}",
* operationId="editStreamer",
* tags={"Stations: Streamers/DJs"},
* description="Update details of a single Streamer/DJ account.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/streamer/{id}",
* operationId="deleteStreamer",
* tags={"Stations: Streamers/DJs"},
* description="Delete a single Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="StationStreamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractScheduledEntityController<Entity\StationStreamer> * @extends AbstractScheduledEntityController<Entity\StationStreamer>
*/ */
class StreamersController extends AbstractScheduledEntityController class StreamersController extends AbstractScheduledEntityController
@ -20,96 +107,6 @@ class StreamersController extends AbstractScheduledEntityController
protected string $entityClass = Entity\StationStreamer::class; protected string $entityClass = Entity\StationStreamer::class;
protected string $resourceRouteName = 'api:stations:streamer'; protected string $resourceRouteName = 'api:stations:streamer';
/**
* @OA\Get(path="/station/{station_id}/streamers",
* tags={"Stations: Streamers/DJs"},
* description="List all current Streamer/DJ accounts for the specified station.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationStreamer"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/streamers",
* tags={"Stations: Streamers/DJs"},
* description="Create a new Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/streamer/{id}",
* tags={"Stations: Streamers/DJs"},
* description="Retrieve details for a single Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/streamer/{id}",
* tags={"Stations: Streamers/DJs"},
* description="Update details of a single Streamer/DJ account.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationStreamer")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Streamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/streamer/{id}",
* tags={"Stations: Streamers/DJs"},
* description="Delete a single Streamer/DJ account.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="StationStreamer ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
/**
* Controller used to respond to AJAX requests from the streamer "Schedule View".
*
* @param ServerRequest $request
* @param Response $response
*/
public function scheduleAction(ServerRequest $request, Response $response): ResponseInterface public function scheduleAction(ServerRequest $request, Response $response): ResponseInterface
{ {
$station = $request->getStation(); $station = $request->getStation();

View File

@ -10,6 +10,93 @@ use InvalidArgumentException;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
/** /**
* @OA\Get(path="/station/{station_id}/webhooks",
* operationId="getWebhooks",
* tags={"Stations: Web Hooks"},
* description="List all current web hooks.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationWebhook"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/webhooks",
* operationId="addWebhook",
* tags={"Stations: Web Hooks"},
* description="Create a new web hook.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/webhook/{id}",
* operationId="getWebhook",
* tags={"Stations: Web Hooks"},
* description="Retrieve details for a single web hook.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/webhook/{id}",
* operationId="editWebhook",
* tags={"Stations: Web Hooks"},
* description="Update details of a single web hook.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/webhook/{id}",
* operationId="deleteWebhook",
* tags={"Stations: Web Hooks"},
* description="Delete a single web hook relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @extends AbstractStationApiCrudController<Entity\StationWebhook> * @extends AbstractStationApiCrudController<Entity\StationWebhook>
*/ */
class WebhooksController extends AbstractStationApiCrudController class WebhooksController extends AbstractStationApiCrudController
@ -17,90 +104,6 @@ class WebhooksController extends AbstractStationApiCrudController
protected string $entityClass = Entity\StationWebhook::class; protected string $entityClass = Entity\StationWebhook::class;
protected string $resourceRouteName = 'api:stations:webhook'; protected string $resourceRouteName = 'api:stations:webhook';
/**
* @OA\Get(path="/station/{station_id}/webhooks",
* tags={"Stations: Web Hooks"},
* description="List all current web hooks.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/StationWebhook"))
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Post(path="/station/{station_id}/webhooks",
* tags={"Stations: Web Hooks"},
* description="Create a new web hook.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Get(path="/station/{station_id}/webhook/{id}",
* tags={"Stations: Web Hooks"},
* description="Retrieve details for a single web hook.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Put(path="/station/{station_id}/webhook/{id}",
* tags={"Stations: Web Hooks"},
* description="Update details of a single web hook.",
* @OA\RequestBody(
* @OA\JsonContent(ref="#/components/schemas/StationWebhook")
* ),
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*
* @OA\Delete(path="/station/{station_id}/webhook/{id}",
* tags={"Stations: Web Hooks"},
* description="Delete a single web hook relay.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="id",
* in="path",
* description="Web Hook ID",
* required=true,
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(response=200, description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Status")
* ),
* @OA\Response(response=403, description="Access denied"),
* security={{"api_key": {}}},
* )
*/
protected function viewRecord(object $record, ServerRequest $request): mixed protected function viewRecord(object $record, ServerRequest $request): mixed
{ {
if (!($record instanceof Entity\StationWebhook)) { if (!($record instanceof Entity\StationWebhook)) {

View File

@ -2,80 +2,86 @@
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
/** #[
* @OA\Info( OA\OpenApi(
* version=AZURACAST_VERSION, info: new OA\Info(
* title="AzuraCast", version: AZURACAST_VERSION,
* description="AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more.", title: 'AzuraCast',
* @OA\License( description: "AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more.",
* name="Apache 2.0", license: new OA\License(
* url="http://www.apache.org/licenses/LICENSE-2.0.html" name: 'Apache 2.0',
* ) url: "http://www.apache.org/licenses/LICENSE-2.0.html"
* ) ),
* ),
* @OA\Server( servers: [
* description=AZURACAST_API_NAME, new OA\Server(
* url=AZURACAST_API_URL description: AZURACAST_API_NAME,
* ) url: AZURACAST_API_URL
* ),
* @OA\ExternalDocumentation( ],
* description="AzuraCast on GitHub", externalDocs: new OA\ExternalDocumentation(
* url="https://github.com/AzuraCast/AzuraCast" description: "AzuraCast on GitHub",
* ) url: "https://github.com/AzuraCast/AzuraCast"
* ),
* @OA\Parameter( tags: [
* parameter="station_id_required", new OA\Tag(
* name="station_id", name: "Now Playing",
* description="The station ID", description: "Endpoints that provide full summaries of the current state of stations.",
* example=1, ),
* in="path",
* required=true, new OA\Tag(name: "Stations: General"),
* @OA\Schema( new OA\Tag(name: "Stations: Song Requests"),
* anyOf={@OA\Schema(type="integer", format="int64"), @OA\Schema(type="string", format="string")} new OA\Tag(name: "Stations: Service Control"),
* )
* ) new OA\Tag(name: "Stations: History"),
* new OA\Tag(name: "Stations: Listeners"),
* @OA\Response( new OA\Tag(name: "Stations: Schedules"),
* response="todo", new OA\Tag(name: "Stations: Media"),
* description="This API call has no documented response (yet)", new OA\Tag(name: "Stations: Mount Points"),
* ) new OA\Tag(name: "Stations: Playlists"),
* new OA\Tag(name: "Stations: Podcasts"),
* @OA\Tag( new OA\Tag(name: "Stations: Queue"),
* name="Now Playing", new OA\Tag(name: "Stations: Remote Relays"),
* description="Endpoints that provide full summaries of the current state of stations.", new OA\Tag(name: "Stations: SFTP Users"),
* ) new OA\Tag(name: "Stations: Streamers/DJs"),
* new OA\Tag(name: "Stations: Web Hooks"),
* @OA\Tag(name="Stations: General")
* @OA\Tag(name="Stations: Song Requests") new OA\Tag(name: "Administration: Custom Fields"),
* @OA\Tag(name="Stations: Service Control") new OA\Tag(name: "Administration: Users"),
* new OA\Tag(name: "Administration: Relays"),
* @OA\Tag(name="Stations: History") new OA\Tag(name: "Administration: Roles"),
* @OA\Tag(name="Stations: Listeners") new OA\Tag(name: "Administration: Settings"),
* @OA\Tag(name="Stations: Schedules") new OA\Tag(name: "Administration: Stations"),
* @OA\Tag(name="Stations: Media") new OA\Tag(name: "Administration: Storage Locations"),
* @OA\Tag(name="Stations: Mount Points")
* @OA\Tag(name="Stations: Playlists") new OA\Tag(name: "Miscellaneous"),
* @OA\Tag(name="Stations: Podcasts") ]
* @OA\Tag(name="Stations: Queue") ),
* @OA\Tag(name="Stations: Remote Relays") OA\Parameter(
* @OA\Tag(name="Stations: SFTP Users") name: "station_id_required",
* @OA\Tag(name="Stations: Streamers/DJs") in: "path",
* @OA\Tag(name="Stations: Web Hooks") required: true,
* schema: new OA\Schema(
* @OA\Tag(name="Administration: Custom Fields") anyOf: [
* @OA\Tag(name="Administration: Users") new OA\Schema(type: "integer", format: "int64"),
* @OA\Tag(name="Administration: Relays") new OA\Schema(type: "string", format: "string"),
* @OA\Tag(name="Administration: Roles") ]
* @OA\Tag(name="Administration: Settings") )
* @OA\Tag(name="Administration: Stations") ),
* @OA\Tag(name="Administration: Storage Locations") OA\Response(
* response: "todo",
* @OA\Tag(name="Miscellaneous") description: "This API call has no documented response (yet)",
* ),
* @OA\SecurityScheme( OA\SecurityScheme(
* type="apiKey", type: "apiKey",
* in="header", in: "header",
* securityScheme="api_key", securityScheme: "api_key",
* name="X-API-Key" name: "X-API-Key"
* ) )
*/ ]
class OpenApi
{
}

File diff suppressed because it is too large Load Diff