Move main controller API annotations into Attributes.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-12-28 23:36:30 -06:00
parent 97ebefa31d
commit cc6753ae81
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
28 changed files with 2567 additions and 1714 deletions

View File

@ -5,93 +5,134 @@ declare(strict_types=1);
namespace App\Controller\Api\Admin;
use App\Entity;
use OpenApi\Annotations as OA;
use OpenApi\Attributes 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> */
#[
OA\Get(
path: '/admin/custom_fields',
operationId: 'getCustomFields',
description: 'List all current custom fields in the system.',
security: [['api_key' => []]],
tags: ['Administration: Custom Fields'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(type: 'array', items: new OA\Items(ref: '#/components/schemas/CustomField'))
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/admin/custom_fields',
operationId: 'addCustomField',
description: 'Create a new custom field.',
security: [['api_key' => []]],
tags: ['Administration: Custom Fields'],
responses: [
new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/CustomField')
),
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/CustomField')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/admin/custom_field/{id}',
operationId: 'getCustomField',
description: 'Retrieve details for a single custom field.',
security: [['api_key' => []]],
tags: ['Administration: Custom Fields'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/CustomField')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/custom_field/{id}',
operationId: 'editCustomField',
description: 'Update details of a single custom field.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/CustomField')
),
tags: ['Administration: Custom Fields'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/admin/custom_field/{id}',
operationId: 'deleteCustomField',
description: 'Delete a single custom field.',
security: [['api_key' => []]],
tags: ['Administration: Custom Fields'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class CustomFieldsController extends AbstractAdminApiCrudController
{
protected string $entityClass = Entity\CustomField::class;

View File

@ -7,22 +7,22 @@ namespace App\Controller\Api\Admin;
use App\Acl;
use App\Http\Response;
use App\Http\ServerRequest;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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": {}}},
* )
*/
#[
OA\Get(
path: '/admin/permissions',
operationId: 'getPermissions',
description: 'Return a list of all available permissions.',
security: [['api_key' => []]],
tags: ['Administration: Roles'],
responses: [
new OA\Response(response: 200, description: 'Success'),
new OA\Response(response: 403, description: 'Access denied'),
]
)
]
class PermissionsController
{
public function __invoke(

View File

@ -10,22 +10,28 @@ use App\Http\Response;
use App\Http\ServerRequest;
use App\Radio\Adapters;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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"))
* )
* )
*/
#[
OA\Get(
path: '/internal/relays',
operationId: 'internalGetRelayDetails',
description: "Returns all necessary information to relay all 'relayable' stations.",
tags: ['Administration: Relays'],
parameters: [],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_Admin_Relay')
)
),
]
)
]
class RelaysController
{
public function __construct(
@ -33,7 +39,6 @@ class RelaysController
protected Adapters $adapters
) {
}
public function __invoke(ServerRequest $request, Response $response): ResponseInterface
{
$stations = $this->getManageableStations($request);

View File

@ -11,98 +11,142 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use RuntimeException;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/admin/roles',
operationId: 'getRoles',
description: 'List all current roles in the system.',
security: [['api_key' => []]],
tags: ['Administration: Roles'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Role')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/admin/roles',
operationId: 'addRole',
description: 'Create a new role.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
tags: ['Administration: Roles'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/admin/role/{id}',
operationId: 'getRole',
description: 'Retrieve details for a single current role.',
security: [['api_key' => []]],
tags: ['Administration: Roles'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'Role ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/role/{id}',
operationId: 'editRole',
description: 'Update details of a single role.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
tags: ['Administration: Roles'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'Role ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/admin/role/{id}',
operationId: 'deleteRole',
description: 'Delete a single role.',
security: [['api_key' => []]],
tags: ['Administration: Roles'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'Role ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class RolesController extends AbstractAdminApiCrudController
{
use CanSortResults;

View File

@ -9,40 +9,54 @@ use App\Doctrine\ReloadableEntityManagerInterface;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/admin/settings',
operationId: 'getSettings',
description: 'List the current values of all editable system settings.',
security: [['api_key' => []]],
tags: ['Administration: Settings'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Settings')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/settings',
operationId: 'editSettings',
description: 'Update settings to modify any settings provided.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Settings')
),
tags: ['Administration: Settings'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class SettingsController extends AbstractApiCrudController
{
protected string $entityClass = Entity\Settings::class;

View File

@ -14,97 +14,141 @@ use App\Radio\Adapters;
use App\Radio\Configuration;
use App\Utilities\File;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/admin/stations',
operationId: 'adminGetStations',
description: 'List all current stations in the system.',
security: [['api_key' => []]],
tags: ['Administration: Stations'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Station')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/admin/stations',
operationId: 'adminAddStation',
description: 'Create a new station.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
tags: ['Administration: Stations'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/admin/station/{id}',
operationId: 'adminGetStation',
description: 'Retrieve details for a single station.',
security: [['api_key' => []]],
tags: ['Administration: Stations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/station/{id}',
operationId: 'adminEditStation',
description: 'Update details of a single station.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
tags: ['Administration: Stations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/admin/station/{id}',
operationId: 'adminDeleteStation',
description: 'Delete a single station.',
security: [['api_key' => []]],
tags: ['Administration: Stations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class StationsController extends AbstractAdminApiCrudController
{
use CanSortResults;
@ -123,7 +167,6 @@ class StationsController extends AbstractAdminApiCrudController
) {
parent::__construct($reloadableEm, $serializer, $validator);
}
/**
* @param ServerRequest $request
* @param Response $response
@ -151,7 +194,6 @@ class StationsController extends AbstractAdminApiCrudController
return $this->listPaginatedFromQuery($request, $response, $qb->getQuery());
}
protected function viewRecord(object $record, ServerRequest $request): mixed
{
if (!($record instanceof $this->entityClass)) {
@ -183,7 +225,6 @@ class StationsController extends AbstractAdminApiCrudController
return $return;
}
/**
* @param Entity\Station $record
* @param array<string, mixed> $context
@ -209,7 +250,6 @@ class StationsController extends AbstractAdminApiCrudController
return parent::toArray($record, $context);
}
protected function fromArray(array $data, ?object $record = null, array $context = []): object
{
foreach (Entity\Station::getStorageLocationTypes() as $locationKey) {
@ -222,7 +262,6 @@ class StationsController extends AbstractAdminApiCrudController
return parent::fromArray($data, $record, $context);
}
/**
* @param array<mixed>|null $data
* @param Entity\Station|null $record
@ -249,7 +288,6 @@ class StationsController extends AbstractAdminApiCrudController
? $this->handleCreate($record)
: $this->handleEdit($record);
}
/**
* @param Entity\Station $record
*/
@ -257,7 +295,6 @@ class StationsController extends AbstractAdminApiCrudController
{
$this->handleDelete($record);
}
protected function handleEdit(Entity\Station $station): Entity\Station
{
$original_record = $this->em->getUnitOfWork()->getOriginalEntityData($station);
@ -295,7 +332,6 @@ class StationsController extends AbstractAdminApiCrudController
return $station;
}
protected function handleCreate(Entity\Station $station): Entity\Station
{
$station->generateAdapterApiKey();
@ -311,7 +347,6 @@ class StationsController extends AbstractAdminApiCrudController
return $station;
}
protected function handleDelete(Entity\Station $station): void
{
$this->configuration->removeConfiguration($station);

View File

@ -9,97 +9,141 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use RuntimeException;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/admin/storage_locations',
operationId: 'getStorageLocations',
description: 'List all current storage locations in the system.',
security: [['api_key' => []]],
tags: ['Administration: Storage Locations'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_Admin_StorageLocation')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/admin/storage_locations',
operationId: 'addStorageLocation',
description: 'Create a new storage location.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
tags: ['Administration: Storage Locations'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/admin/storage_location/{id}',
operationId: 'getStorageLocation',
description: 'Retrieve details for a single storage location.',
security: [['api_key' => []]],
tags: ['Administration: Storage Locations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'User ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/storage_location/{id}',
operationId: 'editStorageLocation',
description: 'Update details of a single storage location.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
tags: ['Administration: Storage Locations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'Storage Location ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/admin/storage_location/{id}',
operationId: 'deleteStorageLocation',
description: 'Delete a single storage location.',
security: [['api_key' => []]],
tags: ['Administration: Storage Locations'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'Storage Location ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class StorageLocationsController extends AbstractAdminApiCrudController
{
protected string $entityClass = Entity\StorageLocation::class;

View File

@ -10,94 +10,138 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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> */
#[
OA\Get(
path: '/admin/users',
operationId: 'getUsers',
description: 'List all current users in the system.',
security: [['api_key' => []]],
tags: ['Administration: Users'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/User')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/admin/users',
operationId: 'addUser',
description: 'Create a new user.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
tags: ['Administration: Users'],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/admin/user/{id}',
operationId: 'getUser',
description: 'Retrieve details for a single current user.',
security: [['api_key' => []]],
tags: ['Administration: Users'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'User ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/admin/user/{id}',
operationId: 'editUser',
description: 'Update details of a single user.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
tags: ['Administration: Users'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'User ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/admin/user/{id}',
operationId: 'deleteUser',
description: 'Delete a single user.',
security: [['api_key' => []]],
tags: ['Administration: Users'],
parameters: [
new OA\Parameter(
name: 'id',
description: 'User ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class UsersController extends AbstractAdminApiCrudController
{
use CanSortResults;

View File

@ -7,57 +7,47 @@ namespace App\Controller\Api;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
class IndexController
{
/**
* Public index for API.
*
* @param ServerRequest $request
* @param Response $response
*/
public function indexAction(ServerRequest $request, Response $response): ResponseInterface
{
return $response->withRedirect('/static/api/index.html');
}
/**
* @OA\Get(path="/status",
* tags={"Miscellaneous"},
* description="Returns an affirmative response if the API is active.",
* parameters={},
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_SystemStatus")
* )
* )
*
* @param ServerRequest $request
* @param Response $response
*/
#[OA\Get(
path: '/status',
description: 'Returns an affirmative response if the API is active.',
tags: ['Miscellaneous'],
parameters: [],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_SystemStatus')
),
]
)]
public function statusAction(ServerRequest $request, Response $response): ResponseInterface
{
return $response->withJson(new Entity\Api\SystemStatus());
}
/**
* @OA\Get(path="/time",
* tags={"Miscellaneous"},
* description="Returns the time (with formatting) in GMT and the user's local time zone, if logged in.",
* parameters={},
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_Time")
* )
* )
*
* @param ServerRequest $request
* @param Response $response
*/
#[OA\Get(
path: '/time',
description: "Returns the time (with formatting) in GMT and the user's local time zone, if logged in.",
tags: ['Miscellaneous'],
parameters: [],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Time')
),
]
)]
public function timeAction(ServerRequest $request, Response $response): ResponseInterface
{
return $response->withJson(new Entity\Api\Time());

View File

@ -9,7 +9,7 @@ use App\Event\Radio\LoadNowPlaying;
use App\Http\Response;
use App\Http\ServerRequest;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\SimpleCache\CacheInterface;
@ -55,38 +55,49 @@ class NowPlayingAction implements EventSubscriberInterface
}
/**
* @OA\Get(path="/nowplaying",
* tags={"Now Playing"},
* description="Returns a full summary of all stations' current state.",
* parameters={},
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Api_NowPlaying"))
* )
* )
*
* @OA\Get(path="/nowplaying/{station_id}",
* tags={"Now Playing"},
* description="Returns a full summary of the specified station's current state.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(ref="#/components/schemas/Api_NowPlaying")
* ),
* @OA\Response(response=404, description="Station not found")
* )
*
* @param ServerRequest $request
* @param Response $response
* @param int|string|null $station_id
*/
public function __invoke(
ServerRequest $request,
Response $response,
$station_id = null
): ResponseInterface {
#[
OA\Get(
path: '/nowplaying',
description: "Returns a full summary of all stations' current state.",
tags: ['Now Playing'],
parameters: [],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_NowPlaying')
)
),
]
),
OA\Get(
path: '/nowplaying/{station_id}',
description: "Returns a full summary of the specified station's current state.",
tags: ['Now Playing'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_NowPlaying')
),
new OA\Response(
response: 404,
description: 'Station not found'
),
]
)
]
public function __invoke(ServerRequest $request, Response $response, $station_id = null): ResponseInterface
{
$router = $request->getRouter();
// Pull NP data from the fastest/first available source using the EventDispatcher.

View File

@ -8,29 +8,37 @@ use App\Entity;
use App\Flysystem\StationFilesystems;
use App\Http\Response;
use App\Http\ServerRequest;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
#[OA\Get(
path: '/station/{station_id}/art/{media_id}',
description: 'Returns the album art for a song, or a generic image.',
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'media_id',
description: 'The station media unique ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'The requested album artwork'
),
new OA\Response(
response: 404,
description: 'Image not found; generic filler image.'
),
]
)]
class GetArtAction
{
/**
* @OA\Get(path="/station/{station_id}/art/{media_id}",
* tags={"Stations: Media"},
* description="Returns the album art for a song, or a generic image.",
* @OA\Parameter(ref="#/components/parameters/station_id_required"),
* @OA\Parameter(
* name="media_id",
* description="The station media unique ID",
* in="path",
* required=true,
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(response=200, description="The requested album artwork"),
* @OA\Response(response=404, description="Image not found; generic filler image.")
* )
*
* @param ServerRequest $request
* @param Response $response
* @param Entity\Repository\StationRepository $stationRepo

View File

@ -14,103 +14,151 @@ use App\Message\WritePlaylistFileMessage;
use App\Radio\Adapters;
use App\Radio\Backend\Liquidsoap;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/station/{station_id}/files',
operationId: 'getFiles',
description: 'List all current uploaded files.',
security: [['api_key' => []]],
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/StationMedia')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/files',
operationId: 'addFile',
description: 'Upload a new file.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_UploadFile')
),
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationMedia')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/file/{id}',
operationId: 'getFile',
description: 'Retrieve details for a single file.',
security: [['api_key' => []]],
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Media ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationMedia')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/file/{id}',
operationId: 'editFile',
description: 'Update details of a single file.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationMedia')
),
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Media ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/file/{id}',
operationId: 'deleteFile',
description: 'Delete a single file.',
security: [['api_key' => []]],
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Media ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class FilesController extends AbstractStationApiCrudController
{
protected string $entityClass = Entity\StationMedia::class;

View File

@ -12,43 +12,53 @@ use App\Utilities\Csv;
use Azura\DoctrineBatchUtils\ReadOnlyBatchIteratorAggregate;
use Carbon\CarbonImmutable;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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": {}}},
* )
*/
#[
OA\Get(
path: '/station/{station_id}/history',
operationId: 'getStationHistory',
description: 'Return song playback history items for a given station.',
security: [['api_key' => []]],
tags: ['Stations: History'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'start',
description: 'The start date for records, in YYYY-MM-DD format.',
in: 'query',
required: false,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'end',
description: 'The end date for records, in YYYY-MM-DD format.',
in: 'query',
required: false,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_DetailedSongHistory')
)
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class HistoryController
{
public function __construct(

View File

@ -8,33 +8,48 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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")
* )
*/
#[
OA\Get(
path: '/stations',
operationId: 'getStations',
description: 'Returns a list of stations.',
tags: ['Stations: General'],
parameters: [],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_NowPlaying_Station')
)
),
]
),
OA\Get(
path: '/station/{station_id}',
operationId: 'getStation',
description: 'Return information about a single station.',
tags: ['Stations: General'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_NowPlaying_Station')
),
new OA\Response(
response: 404,
description: 'Station not found'
),
]
)
]
class IndexController
{
public function __construct(
@ -42,7 +57,6 @@ class IndexController
protected Entity\ApiGenerator\StationApiGenerator $stationApiGenerator
) {
}
public function listAction(ServerRequest $request, Response $response): ResponseInterface
{
$stations_raw = $this->em->getRepository(Entity\Station::class)
@ -61,7 +75,6 @@ class IndexController
return $response->withJson($stations);
}
public function indexAction(ServerRequest $request, Response $response): ResponseInterface
{
$station = $request->getStation();

View File

@ -16,26 +16,40 @@ use Carbon\CarbonImmutable;
use Doctrine\ORM\EntityManagerInterface;
use GuzzleHttp\Psr7\Stream;
use League\Csv\Writer;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
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": {}}},
* )
*/
#[
OA\Get(
path: '/station/{station_id}/listeners',
operationId: 'getStationListeners',
description: 'Return detailed information about current listeners.',
security: [['api_key' => []]],
tags: ['Stations: Listeners'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_Listener')
)
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class ListenersAction
{
public function __invoke(

View File

@ -12,101 +12,149 @@ use App\Http\Response;
use App\Http\Router;
use App\Http\ServerRequest;
use App\Service\Flow\UploadedFile;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/station/{station_id}/mounts',
operationId: 'getStationMounts',
description: 'List all current mount points.',
security: [['api_key' => []]],
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/StationMount')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/mounts',
operationId: 'addMount',
description: 'Create a new mount point.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationMount')
),
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationMount')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/mount/{id}',
operationId: 'getMount',
description: 'Retrieve details for a single mount point.',
security: [['api_key' => []]],
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationMount')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/mount/{id}',
operationId: 'editMount',
description: 'Update details of a single mount point.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationMount')
),
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/mount/{id}',
operationId: 'deleteMount',
description: 'Delete a single mount point.',
security: [['api_key' => []]],
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'StationMount ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class MountsController extends AbstractStationApiCrudController
{
use CanSortResults;

View File

@ -10,100 +10,148 @@ use App\Http\Response;
use App\Http\ServerRequest;
use Carbon\CarbonInterface;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
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> */
#[
OA\Get(
path: '/station/{station_id}/playlists',
operationId: 'getPlaylists',
description: 'List all current playlists.',
security: [['api_key' => []]],
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/StationPlaylist')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/playlists',
operationId: 'addPlaylist',
description: 'Create a new playlist.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationPlaylist')
),
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationPlaylist')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/playlist/{id}',
operationId: 'getPlaylist',
description: 'Retrieve details for a single playlist.',
security: [['api_key' => []]],
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationPlaylist')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/playlist/{id}',
operationId: 'editPlaylist',
description: 'Update details of a single playlist.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationPlaylist')
),
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/playlist/{id}',
operationId: 'deletePlaylist',
description: 'Delete a single playlist relay.',
security: [['api_key' => []]],
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class PlaylistsController extends AbstractScheduledEntityController
{
use CanSortResults;

View File

@ -13,137 +13,185 @@ use App\Http\Response;
use App\Http\ServerRequest;
use App\Service\Flow\UploadedFile;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use RuntimeException;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/station/{station_id}/podcast/{podcast_id}/episodes',
operationId: 'getEpisodes',
description: 'List all current episodes for a given podcast ID.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_PodcastEpisode')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/podcast/{podcast_id}/episodes',
operationId: 'addEpisode',
description: 'Create a new podcast episode.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_PodcastEpisode')
),
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_PodcastEpisode')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'getEpisode',
description: 'Retrieve details for a single podcast episode.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'id',
description: 'Podcast Episode ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_PodcastEpisode')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'editEpisode',
description: 'Update details of a single podcast episode.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_PodcastEpisode')
),
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'id',
description: 'Podcast Episode ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'deleteEpisode',
description: 'Delete a single podcast episode.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'id',
description: 'Podcast Episode ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class PodcastEpisodesController extends AbstractApiCrudController
{
protected string $entityClass = Entity\PodcastEpisode::class;

View File

@ -13,102 +13,150 @@ use App\Http\Response;
use App\Http\ServerRequest;
use App\Service\Flow\UploadedFile;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/station/{station_id}/podcasts',
operationId: 'getPodcasts',
description: 'List all current podcasts.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_Podcast')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/podcasts',
operationId: 'addPodcast',
description: 'Create a new podcast.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Podcast')
),
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Podcast')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/podcast/{id}',
operationId: 'getPodcast',
description: 'Retrieve details for a single podcast.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Podcast')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/podcast/{id}',
operationId: 'editPodcast',
description: 'Update details of a single podcast.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Podcast')
),
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/podcast/{id}',
operationId: 'deletePodcast',
description: 'Delete a single podcast.',
security: [['api_key' => []]],
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class PodcastsController extends AbstractApiCrudController
{
protected string $entityClass = Entity\Podcast::class;

View File

@ -9,69 +9,106 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Serializer;
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> */
#[
OA\Get(
path: '/station/{station_id}/queue',
operationId: 'getQueue',
description: 'Return information about the upcoming song playback queue.',
security: [['api_key' => []]],
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_StationQueueDetailed')
)
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/queue/{id}',
operationId: 'getQueueItem',
description: 'Retrieve details of a single queued item.',
security: [['api_key' => []]],
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Queue Item ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_StationQueueDetailed')
),
new OA\Response(
response: 404,
description: 'Station or Queue ID not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/queue/{id}',
operationId: 'deleteQueueItem',
description: 'Delete a single queued item.',
security: [['api_key' => []]],
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Queue Item ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 404,
description: 'Station or Queue ID not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class QueueController extends AbstractStationApiCrudController
{
protected string $entityClass = Entity\StationQueue::class;

View File

@ -10,99 +10,147 @@ use App\Exception\PermissionDeniedException;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
/**
* @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> */
#[
OA\Get(
path: '/station/{station_id}/remotes',
operationId: 'getRelays',
description: 'List all current remote relays.',
security: [['api_key' => []]],
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_StationRemote')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/remotes',
operationId: 'addRelay',
description: 'Create a new remote relay.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_StationRemote')
),
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_StationRemote')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/remote/{id}',
operationId: 'getRelay',
description: 'Retrieve details for a single remote relay.',
security: [['api_key' => []]],
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_StationRemote')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/remote/{id}',
operationId: 'editRelay',
description: 'Update details of a single remote relay.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_StationRemote')
),
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/remote/{id}',
operationId: 'deleteRelay',
description: 'Delete a single remote relay.',
security: [['api_key' => []]],
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class RemotesController extends AbstractStationApiCrudController
{
use CanSortResults;

View File

@ -11,46 +11,68 @@ use App\Http\ServerRequest;
use App\Paginator;
use App\Utilities;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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")
* )
*/
#[
OA\Get(
path: '/station/{station_id}/requests',
operationId: 'getRequestableSongs',
description: 'Return a list of requestable songs.',
tags: ['Stations: Song Requests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_StationRequest')
)
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Station does not support requests'
),
]
),
OA\Post(
path: '/station/{station_id}/request/{request_id}',
operationId: 'submitSongRequest',
description: 'Submit a song request.',
tags: ['Stations: Song Requests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'request_id',
description: 'The requestable song ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'string')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success'
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Station does not support requests'
),
]
)
]
class RequestsController
{
public function __construct(

View File

@ -11,40 +11,52 @@ use App\Http\ServerRequest;
use App\Radio\AutoDJ\Scheduler;
use Carbon\CarbonImmutable;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Cache\CacheItem;
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")
* )
*/
#[OA\Get(
path: '/station/{station_id}/schedule',
operationId: 'getSchedule',
description: 'Return upcoming and currently ongoing schedule entries.',
tags: ['Stations: Schedules'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'now',
description: 'The date/time to compare schedule items to. Defaults to the current date and time.',
in: 'query',
required: false,
schema: new OA\Schema(type: 'string')
),
new OA\Parameter(
name: 'rows',
description: 'The number of upcoming/ongoing schedule entries to return. Defaults to 5.',
in: 'query',
required: false,
schema: new OA\Schema(type: 'integer')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Api_StationSchedule')
)
),
new OA\Response(
response: 404,
description: 'Station not found'
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)]
class ScheduleAction
{
use HasScheduleDisplay;

View File

@ -12,74 +12,119 @@ use App\Radio\AutoDJ;
use App\Radio\Backend\Liquidsoap;
use App\Radio\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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": {}}}
* )
*/
#[
OA\Get(
path: '/station/{station_id}/status',
operationId: 'getServiceStatus',
description: 'Retrieve the current status of all serivces associated with the radio broadcast.',
security: [['api_key' => []]],
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
schema: '#/components/schemas/Api_StationServiceStatus'
)
),
new OA\Response(
response: 403,
description: 'Access Forbidden',
content: new OA\JsonContent(
schema: '#/components/schemas/Api_Error'
)
),
]
),
OA\Post(
path: '/station/{station_id}/restart',
operationId: 'restartServices',
description: 'Restart all services associated with the radio broadcast.',
security: [['api_key' => []]],
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access Forbidden',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Error')
),
]
),
OA\Post(
path: '/station/{station_id}/frontend/{action}',
operationId: 'doFrontendServiceAction',
description: 'Perform service control actions on the radio frontend (Icecast, SHOUTcast, etc.)',
security: [['api_key' => []]],
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'action',
description: 'The action to perform (start, stop, restart)',
in: 'path',
required: false,
schema: new OA\Schema(type: 'string', default: 'restart')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
schema: '#/components/schemas/Api_Status'
)
),
new OA\Response(
response: 403,
description: 'Access Forbidden',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Error')
),
]
),
OA\Post(
path: '/station/{station_id}/backend/{action}',
operationId: 'doBackendServiceAction',
description: 'Perform service control actions on the radio backend (Liquidsoap)',
security: [['api_key' => []]],
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'action',
description: 'The action to perform (for all: start, stop, restart, skip, disconnect)',
in: 'path',
required: false,
schema: new OA\Schema(type: 'string', default: 'restart')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access Forbidden',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Error')
),
]
)
]
class ServicesController
{
public function __construct(

View File

@ -5,98 +5,146 @@ declare(strict_types=1);
namespace App\Controller\Api\Stations;
use App\Entity;
use OpenApi\Annotations as OA;
use OpenApi\Attributes 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> */
#[
OA\Get(
path: '/station/{station_id}/sftp-users',
operationId: 'getSftpUsers',
description: 'List all current SFTP users.',
security: [['api_key' => []]],
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/SftpUser')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/sftp-users',
operationId: 'addSftpUser',
description: 'Create a new SFTP user.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/SftpUser')
),
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/SftpUser')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'getSftpUser',
description: 'Retrieve details for a single SFTP user.',
security: [['api_key' => []]],
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'SFTP User ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/SftpUser')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'editSftpUser',
description: 'Update details of a single SFTP user.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/SftpUser')
),
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'deleteSftpUser',
description: 'Delete a single remote relay.',
security: [['api_key' => []]],
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class SftpUsersController extends AbstractStationApiCrudController
{
protected string $entityClass = Entity\SftpUser::class;

View File

@ -10,99 +10,147 @@ use App\Exception\StationUnsupportedException;
use App\Http\Response;
use App\Http\ServerRequest;
use Carbon\CarbonInterface;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
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> */
#[
OA\Get(
path: '/station/{station_id}/streamers',
operationId: 'getStreamers',
description: 'List all current Streamer/DJ accounts for the specified station.',
security: [['api_key' => []]],
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/StationStreamer')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/streamers',
operationId: 'addStreamer',
description: 'Create a new Streamer/DJ account.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationStreamer')
),
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationStreamer')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/streamer/{id}',
operationId: 'getStreamer',
description: 'Retrieve details for a single Streamer/DJ account.',
security: [['api_key' => []]],
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationStreamer')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/streamer/{id}',
operationId: 'editStreamer',
description: 'Update details of a single Streamer/DJ account.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationStreamer')
),
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/streamer/{id}',
operationId: 'deleteStreamer',
description: 'Delete a single Streamer/DJ account.',
security: [['api_key' => []]],
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'StationStreamer ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class StreamersController extends AbstractScheduledEntityController
{
use CanSortResults;

View File

@ -9,99 +9,147 @@ use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use InvalidArgumentException;
use OpenApi\Annotations as OA;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
/**
* @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> */
#[
OA\Get(
path: '/station/{station_id}/webhooks',
operationId: 'getWebhooks',
description: 'List all current web hooks.',
security: [['api_key' => []]],
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/StationWebhook')
)
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Post(
path: '/station/{station_id}/webhooks',
operationId: 'addWebhook',
description: 'Create a new web hook.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationWebhook')
),
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationWebhook')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Get(
path: '/station/{station_id}/webhook/{id}',
operationId: 'getWebhook',
description: 'Retrieve details for a single web hook.',
security: [['api_key' => []]],
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/StationWebhook')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Put(
path: '/station/{station_id}/webhook/{id}',
operationId: 'editWebhook',
description: 'Update details of a single web hook.',
security: [['api_key' => []]],
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/StationWebhook')
),
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
),
OA\Delete(
path: '/station/{station_id}/webhook/{id}',
operationId: 'deleteWebhook',
description: 'Delete a single web hook relay.',
security: [['api_key' => []]],
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',
in: 'path',
required: true,
schema: new OA\Schema(type: 'integer', format: 'int64')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/Api_Status')
),
new OA\Response(
response: 403,
description: 'Access denied'
),
]
)
]
class WebhooksController extends AbstractStationApiCrudController
{
use CanSortResults;

View File

@ -157,7 +157,6 @@ paths:
- 'Administration: Relays'
description: 'Returns all necessary information to relay all ''relayable'' stations.'
operationId: internalGetRelayDetails
parameters: []
responses:
'200':
description: Success
@ -717,7 +716,6 @@ paths:
- Miscellaneous
description: 'Returns an affirmative response if the API is active.'
operationId: bc32a129ca3e8ad2060b71bdd90da78d
parameters: []
responses:
'200':
description: Success
@ -731,7 +729,6 @@ paths:
- Miscellaneous
description: 'Returns the time (with formatting) in GMT and the user''s local time zone, if logged in.'
operationId: 3092a8238a915a0b6b324f2a90942a94
parameters: []
responses:
'200':
description: Success
@ -745,7 +742,6 @@ paths:
- 'Now Playing'
description: 'Returns a full summary of all stations'' current state.'
operationId: 2ac086b9720325236f99cd3c185cc5c8
parameters: []
responses:
'200':
description: Success
@ -778,7 +774,6 @@ paths:
tags:
- 'Stations: Media'
description: 'Returns the album art for a song, or a generic image.'
operationId: 1b9853f0af3c8fbe4d3af9af0e6d1a45
parameters:
-
$ref: '#/components/parameters/station_id_required'
@ -977,7 +972,6 @@ paths:
- 'Stations: General'
description: 'Returns a list of stations.'
operationId: getStations
parameters: []
responses:
'200':
description: Success
@ -1847,6 +1841,12 @@ paths:
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Api_StationRequest'
'404':
description: 'Station not found'
'403':
@ -1922,8 +1922,16 @@ paths:
responses:
'200':
description: Success
content:
application/json:
schema:
schema: '#/components/schemas/Api_StationServiceStatus'
'403':
description: 'Access Forbidden'
content:
application/json:
schema:
schema: '#/components/schemas/Api_Error'
security:
-
api_key: []
@ -1939,8 +1947,16 @@ paths:
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Api_Status'
'403':
description: 'Access Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Api_Error'
security:
-
api_key: []
@ -1964,8 +1980,16 @@ paths:
responses:
'200':
description: Success
content:
application/json:
schema:
schema: '#/components/schemas/Api_Status'
'403':
description: 'Access Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Api_Error'
security:
-
api_key: []
@ -1981,7 +2005,7 @@ paths:
-
name: action
in: path
description: 'The action to perform (for all: start, stop, restart; for Liquidsoap only: skip, disconnect)'
description: 'The action to perform (for all: start, stop, restart, skip, disconnect)'
required: false
schema:
type: string
@ -1989,8 +2013,16 @@ paths:
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Api_Status'
'403':
description: 'Access Forbidden'
content:
application/json:
schema:
$ref: '#/components/schemas/Api_Error'
security:
-
api_key: []