Use constants in API definitions; update Swagger UI.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-12-29 15:19:34 -06:00
parent cc6753ae81
commit 38cd3945e2
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
52 changed files with 266 additions and 210 deletions

View File

@ -55,7 +55,7 @@ class GenerateApiDocsCommand extends CommandAbstract
$finder = Util::finder(
[
$this->environment->getBaseDirectory() . '/util/openapi.php',
$this->environment->getBaseDirectory() . '/src/OpenApi.php',
$this->environment->getBaseDirectory() . '/src/Entity',
$this->environment->getBaseDirectory() . '/src/Controller/Api',
],

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Api\Admin;
use App\Entity;
use App\OpenApi;
use OpenApi\Attributes as OA;
/** @extends AbstractAdminApiCrudController<Entity\CustomField> */
@ -13,7 +14,7 @@ use OpenApi\Attributes as OA;
path: '/admin/custom_fields',
operationId: 'getCustomFields',
description: 'List all current custom fields in the system.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Custom Fields'],
responses: [
new OA\Response(
@ -31,7 +32,7 @@ use OpenApi\Attributes as OA;
path: '/admin/custom_fields',
operationId: 'addCustomField',
description: 'Create a new custom field.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Custom Fields'],
responses: [
new OA\RequestBody(
@ -52,7 +53,7 @@ use OpenApi\Attributes as OA;
path: '/admin/custom_field/{id}',
operationId: 'getCustomField',
description: 'Retrieve details for a single custom field.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Custom Fields'],
parameters: [
new OA\Parameter(
@ -79,7 +80,7 @@ use OpenApi\Attributes as OA;
path: '/admin/custom_field/{id}',
operationId: 'editCustomField',
description: 'Update details of a single custom field.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/CustomField')
),
@ -109,7 +110,7 @@ use OpenApi\Attributes as OA;
path: '/admin/custom_field/{id}',
operationId: 'deleteCustomField',
description: 'Delete a single custom field.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Custom Fields'],
parameters: [
new OA\Parameter(

View File

@ -7,6 +7,7 @@ namespace App\Controller\Api\Admin;
use App\Acl;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -15,7 +16,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/permissions',
operationId: 'getPermissions',
description: 'Return a list of all available permissions.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Roles'],
responses: [
new OA\Response(response: 200, description: 'Success'),

View File

@ -10,6 +10,7 @@ use App\Doctrine\ReloadableEntityManagerInterface;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -24,7 +25,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/roles',
operationId: 'getRoles',
description: 'List all current roles in the system.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Roles'],
responses: [
new OA\Response(
@ -45,7 +46,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/roles',
operationId: 'addRole',
description: 'Create a new role.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
@ -66,7 +67,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/role/{id}',
operationId: 'getRole',
description: 'Retrieve details for a single current role.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Roles'],
parameters: [
new OA\Parameter(
@ -93,7 +94,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/role/{id}',
operationId: 'editRole',
description: 'Update details of a single role.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Role')
),
@ -123,7 +124,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/role/{id}',
operationId: 'deleteRole',
description: 'Delete a single role.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Roles'],
parameters: [
new OA\Parameter(

View File

@ -9,6 +9,7 @@ use App\Doctrine\ReloadableEntityManagerInterface;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
@ -21,7 +22,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/settings',
operationId: 'getSettings',
description: 'List the current values of all editable system settings.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Settings'],
responses: [
new OA\Response(
@ -39,7 +40,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/settings',
operationId: 'editSettings',
description: 'Update settings to modify any settings provided.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Settings')
),

View File

@ -10,6 +10,7 @@ use App\Entity;
use App\Exception\ValidationException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Radio\Adapters;
use App\Radio\Configuration;
use App\Utilities\File;
@ -26,7 +27,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/stations',
operationId: 'adminGetStations',
description: 'List all current stations in the system.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Stations'],
responses: [
new OA\Response(
@ -47,7 +48,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/stations',
operationId: 'adminAddStation',
description: 'Create a new station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
@ -68,7 +69,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/station/{id}',
operationId: 'adminGetStation',
description: 'Retrieve details for a single station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Stations'],
parameters: [
new OA\Parameter(
@ -95,7 +96,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/station/{id}',
operationId: 'adminEditStation',
description: 'Update details of a single station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Station')
),
@ -125,7 +126,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/station/{id}',
operationId: 'adminDeleteStation',
description: 'Delete a single station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Stations'],
parameters: [
new OA\Parameter(

View File

@ -8,6 +8,7 @@ use App\Doctrine\ReloadableEntityManagerInterface;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -21,7 +22,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/storage_locations',
operationId: 'getStorageLocations',
description: 'List all current storage locations in the system.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Storage Locations'],
responses: [
new OA\Response(
@ -42,7 +43,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/storage_locations',
operationId: 'addStorageLocation',
description: 'Create a new storage location.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
@ -63,7 +64,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/storage_location/{id}',
operationId: 'getStorageLocation',
description: 'Retrieve details for a single storage location.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Storage Locations'],
parameters: [
new OA\Parameter(
@ -90,7 +91,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/storage_location/{id}',
operationId: 'editStorageLocation',
description: 'Update details of a single storage location.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/Api_Admin_StorageLocation')
),
@ -120,7 +121,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/admin/storage_location/{id}',
operationId: 'deleteStorageLocation',
description: 'Delete a single storage location.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Storage Locations'],
parameters: [
new OA\Parameter(

View File

@ -9,6 +9,7 @@ use App\Controller\Frontend\Account\MasqueradeAction;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -19,7 +20,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/users',
operationId: 'getUsers',
description: 'List all current users in the system.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Users'],
responses: [
new OA\Response(
@ -40,7 +41,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/users',
operationId: 'addUser',
description: 'Create a new user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
@ -61,7 +62,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/user/{id}',
operationId: 'getUser',
description: 'Retrieve details for a single current user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Users'],
parameters: [
new OA\Parameter(
@ -88,7 +89,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/user/{id}',
operationId: 'editUser',
description: 'Update details of a single user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
requestBody: new OA\RequestBody(
content: new OA\JsonContent(ref: '#/components/schemas/User')
),
@ -118,7 +119,7 @@ use Psr\Http\Message\ResponseInterface;
path: '/admin/user/{id}',
operationId: 'deleteUser',
description: 'Delete a single user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Administration: Users'],
parameters: [
new OA\Parameter(

View File

@ -8,6 +8,7 @@ use App\Entity;
use App\Event\Radio\LoadNowPlaying;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Attributes as OA;
use Psr\EventDispatcher\EventDispatcherInterface;
@ -81,7 +82,7 @@ class NowPlayingAction implements EventSubscriberInterface
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'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(

View File

@ -8,6 +8,7 @@ use App\Entity;
use App\Flysystem\StationFilesystems;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -16,7 +17,7 @@ use Psr\Http\Message\ResponseInterface;
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'media_id',
description: 'The station media unique ID',

View File

@ -11,6 +11,7 @@ use App\Flysystem\StationFilesystems;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Message\WritePlaylistFileMessage;
use App\OpenApi;
use App\Radio\Adapters;
use App\Radio\Backend\Liquidsoap;
use InvalidArgumentException;
@ -27,10 +28,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/files',
operationId: 'getFiles',
description: 'List all current uploaded files.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -51,13 +52,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/files',
operationId: 'addFile',
description: 'Upload a new file.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -75,10 +76,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/file/{id}',
operationId: 'getFile',
description: 'Retrieve details for a single file.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Media ID',
@ -103,13 +104,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/file/{id}',
operationId: 'editFile',
description: 'Update details of a single file.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Media ID',
@ -134,10 +135,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/file/{id}',
operationId: 'deleteFile',
description: 'Delete a single file.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Media'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Media ID',

View File

@ -8,6 +8,7 @@ use App;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Utilities\Csv;
use Azura\DoctrineBatchUtils\ReadOnlyBatchIteratorAggregate;
use Carbon\CarbonImmutable;
@ -20,10 +21,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/history',
operationId: 'getStationHistory',
description: 'Return song playback history items for a given station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: History'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'start',
description: 'The start date for records, in YYYY-MM-DD format.',

View File

@ -7,6 +7,7 @@ namespace App\Controller\Api\Stations;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -35,7 +36,7 @@ use Psr\Http\Message\ResponseInterface;
description: 'Return information about a single station.',
tags: ['Stations: General'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(

View File

@ -9,6 +9,7 @@ use App\Environment;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Locale;
use App\OpenApi;
use App\Service\DeviceDetector;
use App\Service\IpGeolocation;
use Azura\DoctrineBatchUtils\ReadOnlyBatchIteratorAggregate;
@ -25,10 +26,10 @@ use RuntimeException;
path: '/station/{station_id}/listeners',
operationId: 'getStationListeners',
description: 'Return detailed information about current listeners.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Listeners'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(

View File

@ -11,6 +11,7 @@ use App\Exception\StationUnsupportedException;
use App\Http\Response;
use App\Http\Router;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Service\Flow\UploadedFile;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -23,10 +24,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/mounts',
operationId: 'getStationMounts',
description: 'List all current mount points.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -47,13 +48,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/mounts',
operationId: 'addMount',
description: 'Create a new mount point.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -71,10 +72,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/mount/{id}',
operationId: 'getMount',
description: 'Retrieve details for a single mount point.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
@ -99,13 +100,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/mount/{id}',
operationId: 'editMount',
description: 'Update details of a single mount point.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
@ -130,10 +131,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/mount/{id}',
operationId: 'deleteMount',
description: 'Delete a single mount point.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Mount Points'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'StationMount ID',

View File

@ -8,6 +8,7 @@ use App\Controller\Api\Traits\CanSortResults;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use Carbon\CarbonInterface;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
@ -20,10 +21,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
path: '/station/{station_id}/playlists',
operationId: 'getPlaylists',
description: 'List all current playlists.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -44,13 +45,13 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
path: '/station/{station_id}/playlists',
operationId: 'addPlaylist',
description: 'Create a new playlist.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -68,10 +69,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
path: '/station/{station_id}/playlist/{id}',
operationId: 'getPlaylist',
description: 'Retrieve details for a single playlist.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',
@ -96,13 +97,13 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
path: '/station/{station_id}/playlist/{id}',
operationId: 'editPlaylist',
description: 'Update details of a single playlist.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',
@ -127,10 +128,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
path: '/station/{station_id}/playlist/{id}',
operationId: 'deletePlaylist',
description: 'Delete a single playlist relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Playlists'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Playlist ID',

View File

@ -11,6 +11,7 @@ use App\Entity;
use App\Flysystem\StationFilesystems;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Service\Flow\UploadedFile;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
@ -25,10 +26,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{podcast_id}/episodes',
operationId: 'getEpisodes',
description: 'List all current episodes for a given podcast ID.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
@ -56,13 +57,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{podcast_id}/episodes',
operationId: 'addEpisode',
description: 'Create a new podcast episode.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
@ -87,10 +88,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'getEpisode',
description: 'Retrieve details for a single podcast episode.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
@ -122,13 +123,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'editEpisode',
description: 'Update details of a single podcast episode.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',
@ -160,10 +161,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{podcast_id}/episode/{id}',
operationId: 'deleteEpisode',
description: 'Delete a single podcast episode.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'podcast_id',
description: 'Podcast ID',

View File

@ -11,6 +11,7 @@ use App\Entity;
use App\Flysystem\StationFilesystems;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Service\Flow\UploadedFile;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
@ -25,10 +26,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcasts',
operationId: 'getPodcasts',
description: 'List all current podcasts.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -49,13 +50,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcasts',
operationId: 'addPodcast',
description: 'Create a new podcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -73,10 +74,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{id}',
operationId: 'getPodcast',
description: 'Retrieve details for a single podcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',
@ -101,13 +102,13 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{id}',
operationId: 'editPodcast',
description: 'Update details of a single podcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',
@ -132,10 +133,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/podcast/{id}',
operationId: 'deletePodcast',
description: 'Delete a single podcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Podcasts'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Podcast ID',

View File

@ -8,6 +8,7 @@ use App;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -20,10 +21,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/queue',
operationId: 'getQueue',
description: 'Return information about the upcoming song playback queue.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -48,10 +49,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/queue/{id}',
operationId: 'getQueueItem',
description: 'Retrieve details of a single queued item.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Queue Item ID',
@ -80,10 +81,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
path: '/station/{station_id}/queue/{id}',
operationId: 'deleteQueueItem',
description: 'Delete a single queued item.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Queue'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Queue Item ID',

View File

@ -9,6 +9,7 @@ use App\Entity;
use App\Exception\PermissionDeniedException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -19,10 +20,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/remotes',
operationId: 'getRelays',
description: 'List all current remote relays.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -43,13 +44,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/remotes',
operationId: 'addRelay',
description: 'Create a new remote relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -67,10 +68,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/remote/{id}',
operationId: 'getRelay',
description: 'Retrieve details for a single remote relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
@ -95,13 +96,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/remote/{id}',
operationId: 'editRelay',
description: 'Update details of a single remote relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
@ -126,10 +127,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/remote/{id}',
operationId: 'deleteRelay',
description: 'Delete a single remote relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Remote Relays'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',

View File

@ -8,6 +8,7 @@ use App\Entity;
use App\Exception;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Paginator;
use App\Utilities;
use Doctrine\ORM\EntityManagerInterface;
@ -21,7 +22,7 @@ use Psr\Http\Message\ResponseInterface;
description: 'Return a list of requestable songs.',
tags: ['Stations: Song Requests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -48,7 +49,7 @@ use Psr\Http\Message\ResponseInterface;
description: 'Submit a song request.',
tags: ['Stations: Song Requests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'request_id',
description: 'The requestable song ID',

View File

@ -8,6 +8,7 @@ use App\Controller\Api\Traits\HasScheduleDisplay;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Radio\AutoDJ\Scheduler;
use Carbon\CarbonImmutable;
use Doctrine\ORM\EntityManagerInterface;
@ -22,7 +23,7 @@ use Symfony\Contracts\Cache\CacheInterface;
description: 'Return upcoming and currently ongoing schedule entries.',
tags: ['Stations: Schedules'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'now',
description: 'The date/time to compare schedule items to. Defaults to the current date and time.',

View File

@ -8,6 +8,7 @@ use App\Entity;
use App\Exception\Supervisor\NotRunningException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use App\Radio\AutoDJ;
use App\Radio\Backend\Liquidsoap;
use App\Radio\Configuration;
@ -20,24 +21,24 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/status',
operationId: 'getServiceStatus',
description: 'Retrieve the current status of all serivces associated with the radio broadcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: new OA\JsonContent(
schema: '#/components/schemas/Api_StationServiceStatus'
ref: '#/components/schemas/Api_StationServiceStatus'
)
),
new OA\Response(
response: 403,
description: 'Access Forbidden',
content: new OA\JsonContent(
schema: '#/components/schemas/Api_Error'
ref: '#/components/schemas/Api_Error'
)
),
]
@ -46,10 +47,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/restart',
operationId: 'restartServices',
description: 'Restart all services associated with the radio broadcast.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -68,10 +69,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/frontend/{action}',
operationId: 'doFrontendServiceAction',
description: 'Perform service control actions on the radio frontend (Icecast, SHOUTcast, etc.)',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'action',
description: 'The action to perform (start, stop, restart)',
@ -99,10 +100,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/backend/{action}',
operationId: 'doBackendServiceAction',
description: 'Perform service control actions on the radio backend (Liquidsoap)',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Service Control'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'action',
description: 'The action to perform (for all: start, stop, restart, skip, disconnect)',

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Api\Stations;
use App\Entity;
use App\OpenApi;
use OpenApi\Attributes as OA;
/** @extends AbstractStationApiCrudController<Entity\SftpUser> */
@ -13,10 +14,10 @@ use OpenApi\Attributes as OA;
path: '/station/{station_id}/sftp-users',
operationId: 'getSftpUsers',
description: 'List all current SFTP users.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -37,13 +38,13 @@ use OpenApi\Attributes as OA;
path: '/station/{station_id}/sftp-users',
operationId: 'addSftpUser',
description: 'Create a new SFTP user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -61,10 +62,10 @@ use OpenApi\Attributes as OA;
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'getSftpUser',
description: 'Retrieve details for a single SFTP user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'SFTP User ID',
@ -89,13 +90,13 @@ use OpenApi\Attributes as OA;
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'editSftpUser',
description: 'Update details of a single SFTP user.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',
@ -120,10 +121,10 @@ use OpenApi\Attributes as OA;
path: '/station/{station_id}/sftp-user/{id}',
operationId: 'deleteSftpUser',
description: 'Delete a single remote relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: SFTP Users'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Remote Relay ID',

View File

@ -9,6 +9,7 @@ use App\Entity;
use App\Exception\StationUnsupportedException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use Carbon\CarbonInterface;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -19,10 +20,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/streamers',
operationId: 'getStreamers',
description: 'List all current Streamer/DJ accounts for the specified station.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -43,13 +44,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/streamers',
operationId: 'addStreamer',
description: 'Create a new Streamer/DJ account.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -67,10 +68,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/streamer/{id}',
operationId: 'getStreamer',
description: 'Retrieve details for a single Streamer/DJ account.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
@ -95,13 +96,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/streamer/{id}',
operationId: 'editStreamer',
description: 'Update details of a single Streamer/DJ account.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Streamer ID',
@ -126,10 +127,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/streamer/{id}',
operationId: 'deleteStreamer',
description: 'Delete a single Streamer/DJ account.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Streamers/DJs'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'StationStreamer ID',

View File

@ -8,6 +8,7 @@ use App\Controller\Api\Traits\CanSortResults;
use App\Entity;
use App\Http\Response;
use App\Http\ServerRequest;
use App\OpenApi;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
@ -18,10 +19,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/webhooks',
operationId: 'getWebhooks',
description: 'List all current web hooks.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -42,13 +43,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/webhooks',
operationId: 'addWebhook',
description: 'Create a new web hook.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
],
responses: [
new OA\Response(
@ -66,10 +67,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/webhook/{id}',
operationId: 'getWebhook',
description: 'Retrieve details for a single web hook.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',
@ -94,13 +95,13 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/webhook/{id}',
operationId: 'editWebhook',
description: 'Update details of a single web hook.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
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(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',
@ -125,10 +126,10 @@ use Psr\Http\Message\ResponseInterface;
path: '/station/{station_id}/webhook/{id}',
operationId: 'deleteWebhook',
description: 'Delete a single web hook relay.',
security: [['api_key' => []]],
security: OpenApi::API_KEY_SECURITY,
tags: ['Stations: Web Hooks'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/station_id_required'),
new OA\Parameter(ref: OpenApi::STATION_ID_REQUIRED),
new OA\Parameter(
name: 'id',
description: 'Web Hook ID',

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Entity\Api;
use App\OpenApi;
use OpenApi\Attributes as OA;
#[OA\Schema(
@ -57,13 +58,13 @@ class Listener
#[OA\Property(
description: 'UNIX timestamp that the user first connected.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $connected_on;
#[OA\Property(
description: 'UNIX timestamp that the user disconnected (or the latest timestamp if they are still connected).',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $connected_until;

View File

@ -6,6 +6,7 @@ namespace App\Entity\Api\NowPlaying;
use App\Entity\Api\ResolvableUrlInterface;
use App\Entity\Api\Song;
use App\OpenApi;
use OpenApi\Attributes as OA;
use Psr\Http\Message\UriInterface;
@ -22,7 +23,7 @@ class SongHistory implements ResolvableUrlInterface
#[OA\Property(
description: 'UNIX timestamp when playback started.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $played_at = 0;

View File

@ -6,6 +6,7 @@ namespace App\Entity\Api\NowPlaying;
use App\Entity\Api\ResolvableUrlInterface;
use App\Entity\Api\Song;
use App\OpenApi;
use OpenApi\Attributes as OA;
use Psr\Http\Message\UriInterface;
@ -17,13 +18,13 @@ class StationQueue implements ResolvableUrlInterface
{
#[OA\Property(
description: 'UNIX timestamp when the AutoDJ is expected to queue the song for playback.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $cued_at = 0;
#[OA\Property(
description: 'UNIX timestamp when playback is expected to start.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $played_at = 0;

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Entity\Api;
use App\OpenApi;
use OpenApi\Attributes as OA;
#[OA\Schema(
@ -45,7 +46,7 @@ class StationSchedule
#[OA\Property(
description: 'The start time of the schedule entry, in UNIX format.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $start_timestamp;
@ -57,7 +58,7 @@ class StationSchedule
#[OA\Property(
description: 'The end time of the schedule entry, in UNIX format.',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $end_timestamp;

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Entity\Api;
use App\OpenApi;
use OpenApi\Attributes as OA;
#[OA\Schema(
@ -20,7 +21,7 @@ class SystemStatus
#[OA\Property(
description: 'The current UNIX timestamp',
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
)]
public int $timestamp;

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Entity;
use App\Entity\Interfaces\IdentifiableEntityInterface;
use App\OpenApi;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -43,13 +44,13 @@ class Relay implements IdentifiableEntityInterface
protected mixed $nowplaying;
#[
OA\Property(example: 1609480800),
OA\Property(example: OpenApi::SAMPLE_TIMESTAMP),
ORM\Column
]
protected int $created_at;
#[
OA\Property(example: 1609480800),
OA\Property(example: OpenApi::SAMPLE_TIMESTAMP),
ORM\Column
]
protected int $updated_at;

View File

@ -8,6 +8,7 @@ use App\Customization;
use App\Doctrine\Generator\UuidV6Generator;
use App\Entity;
use App\Event\GetSyncTasks;
use App\OpenApi;
use App\Service\Avatar;
use App\Utilities\Urls;
use Doctrine\ORM\Mapping as ORM;
@ -279,7 +280,10 @@ class Settings implements Stringable
}
#[
OA\Property(description: "The UNIX timestamp when updates were last checked.", example: 1609480800),
OA\Property(
description: "The UNIX timestamp when updates were last checked.",
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore
]
@ -599,7 +603,10 @@ class Settings implements Stringable
}
#[
OA\Property(description: "The UNIX timestamp when automated backup was last run.", example: 1609480800),
OA\Property(
description: "The UNIX timestamp when automated backup was last run.",
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore,
Groups(self::GROUP_BACKUP)
@ -640,7 +647,10 @@ class Settings implements Stringable
}
#[
OA\Property(description: "The UNIX timestamp when setup was last completed.", example: 1609480800),
OA\Property(
description: "The UNIX timestamp when setup was last completed.",
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column
]
protected int $setup_complete_time = 0;
@ -691,7 +701,7 @@ class Settings implements Stringable
#[
OA\Property(
description: "The UNIX timestamp when the now playing sync task was last run.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore
@ -711,7 +721,7 @@ class Settings implements Stringable
#[
OA\Property(
description: "The UNIX timestamp when the 60-second 'short' sync task was last run.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore
@ -731,7 +741,7 @@ class Settings implements Stringable
#[
OA\Property(
description: "The UNIX timestamp when the 5-minute 'medium' sync task was last run.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore
@ -751,7 +761,7 @@ class Settings implements Stringable
#[
OA\Property(
description: "The UNIX timestamp when the 1-hour 'long' sync task was last run.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore
@ -840,7 +850,7 @@ class Settings implements Stringable
#[
OA\Property(
description: "The UNIX timestamp when the Maxmind Geolite was last downloaded.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column,
Attributes\AuditIgnore,

View File

@ -8,6 +8,7 @@ use App\Entity\Interfaces\IdentifiableEntityInterface;
use App\Entity\Interfaces\PathAwareInterface;
use App\Entity\Interfaces\ProcessableMediaInterface;
use App\Entity\Interfaces\SongInterface;
use App\OpenApi;
use App\Utilities\Time;
use Azura\MetadataManager\Metadata;
use Azura\MetadataManager\MetadataInterface;
@ -121,7 +122,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar
#[
OA\Property(
description: "The UNIX timestamp when the database was last modified.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column(nullable: true)
]
@ -184,7 +185,7 @@ class StationMedia implements SongInterface, ProcessableMediaInterface, PathAwar
#[
OA\Property(
description: "The latest time (UNIX timestamp) when album art was updated.",
example: 1609480800
example: OpenApi::SAMPLE_TIMESTAMP
),
ORM\Column
]

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Entity;
use App\OpenApi;
use App\Validator\Constraints\UniqueEntity;
use Azura\Normalizer\Attributes\DeepNormalize;
use Doctrine\Common\Collections\ArrayCollection;
@ -85,7 +86,7 @@ class StationStreamer implements
protected bool $enforce_schedule = false;
#[
OA\Property(example: 1609480800),
OA\Property(example: OpenApi::SAMPLE_TIMESTAMP),
ORM\Column(nullable: true),
Attributes\AuditIgnore
]

View File

@ -7,6 +7,7 @@ namespace App\Entity;
use App\Auth;
use App\Entity\Interfaces\EntityGroupsInterface;
use App\Entity\Interfaces\IdentifiableEntityInterface;
use App\OpenApi;
use App\Utilities\Strings;
use App\Validator\Constraints\UniqueEntity;
use Azura\Normalizer\Attributes\DeepNormalize;
@ -88,7 +89,7 @@ class User implements Stringable, IdentifiableEntityInterface
protected ?string $two_factor_secret = null;
#[
OA\Property(example: 1609480800),
OA\Property(example: OpenApi::SAMPLE_TIMESTAMP),
ORM\Column,
Attributes\AuditIgnore,
Groups([EntityGroupsInterface::GROUP_ADMIN, EntityGroupsInterface::GROUP_ALL])
@ -96,7 +97,7 @@ class User implements Stringable, IdentifiableEntityInterface
protected int $created_at;
#[
OA\Property(example: 1609480800),
OA\Property(example: OpenApi::SAMPLE_TIMESTAMP),
ORM\Column,
Attributes\AuditIgnore,
Groups([EntityGroupsInterface::GROUP_ADMIN, EntityGroupsInterface::GROUP_ALL])

View File

@ -1,12 +1,18 @@
<?php
declare(strict_types=1);
namespace App;
use OpenApi\Attributes as OA;
#[
OA\OpenApi(
openapi: '3.0.0',
info: new OA\Info(
version: AZURACAST_VERSION,
description: "AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more.",
description: "AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by"
. " AzuraCast expose a public API for viewing now playing data, making requests and more.",
title: 'AzuraCast',
license: new OA\License(
name: 'Apache 2.0',
@ -81,7 +87,9 @@ use OpenApi\Attributes as OA;
]
class OpenApi
{
public const SAMPLE_TIMESTAMP = 1609480800;
public const API_KEY_SECURITY = [['api_key' => []]];
public const STATION_ID_REQUIRED = '#/components/parameters/station_id_required';
}

View File

@ -8,6 +8,10 @@ ini_set('display_errors', 1);
$autoloader = require dirname(__DIR__) . '/vendor/autoload.php';
const AZURACAST_VERSION = App\Version::FALLBACK_VERSION;
const AZURACAST_API_URL = 'https://localhost/api';
const AZURACAST_API_NAME = 'Testing API';
App\AppFactory::createCli(
$autoloader,
[

View File

@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css"/>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
@ -31,30 +31,30 @@
</head>
<body>
<div id="swagger-ui"></div>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js" charset="UTF-8"></script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"></script>
<script>
window.onload = function () {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: '/api/openapi.yml',
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: 'StandaloneLayout'
});
// End Swagger UI call region
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "/api/openapi.yml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
// End Swagger UI call region
window.ui = ui;
};
window.ui = ui;
};
</script>
</body>
</html>

View File

@ -1,4 +1,4 @@
openapi: 3.1.0
openapi: 3.0.0
info:
title: AzuraCast
description: 'AzuraCast is a standalone, turnkey web radio management tool. Radio stations hosted by AzuraCast expose a public API for viewing now playing data, making requests and more.'
@ -1925,13 +1925,13 @@ paths:
content:
application/json:
schema:
schema: '#/components/schemas/Api_StationServiceStatus'
$ref: '#/components/schemas/Api_StationServiceStatus'
'403':
description: 'Access Forbidden'
content:
application/json:
schema:
schema: '#/components/schemas/Api_Error'
$ref: '#/components/schemas/Api_Error'
security:
-
api_key: []

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long