Files
speedtest-tracker/app/OpenApi/Annotations/V1/StatsAnnotations.php
T
Alex Justesen 4abbfe40fe API requires accept json header (#2333)
Co-authored-by: Alex Justesen <1144087+alexjustesen@users.noreply.github.com>
Co-authored-by: GitHub Action <actions@github.com>
2025-09-14 10:51:24 -04:00

66 lines
2.3 KiB
PHP

<?php
namespace App\OpenApi\Annotations\V1;
use Illuminate\Http\Response;
use OpenApi\Attributes as OA;
#[OA\PathItem(
path: '/api/v1/stats',
description: 'Endpoints for viewing performance statistics.'
)]
class StatsAnnotations
{
#[OA\Get(
path: '/api/v1/stats',
summary: 'Fetch aggregated Speedtest statistics',
operationId: 'getStats',
tags: ['Stats'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/AcceptHeader'),
new OA\Parameter(
name: 'start_at',
in: 'query',
description: 'Filter stats from this date/time (ISO 8601)',
required: false,
schema: new OA\Schema(type: 'string', format: 'date-time')
),
new OA\Parameter(
name: 'end_at',
in: 'query',
description: 'Filter stats up to this date/time (ISO 8601)',
required: false,
schema: new OA\Schema(type: 'string', format: 'date-time')
),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Statistics fetched successfully',
content: new OA\JsonContent(ref: '#/components/schemas/Stats')
),
new OA\Response(
response: Response::HTTP_UNAUTHORIZED,
description: 'Unauthenticated',
content: new OA\JsonContent(ref: '#/components/schemas/UnauthenticatedError')
),
new OA\Response(
response: Response::HTTP_FORBIDDEN,
description: 'Forbidden',
content: new OA\JsonContent(ref: '#/components/schemas/ForbiddenError')
),
new OA\Response(
response: Response::HTTP_NOT_ACCEPTABLE,
description: 'Not Acceptable - Missing or invalid Accept header',
content: new OA\JsonContent(ref: '#/components/schemas/NotAcceptableError')
),
new OA\Response(
response: Response::HTTP_UNPROCESSABLE_ENTITY,
description: 'Validation error',
content: new OA\JsonContent(ref: '#/components/schemas/ValidationError')
),
]
)]
public function getStats(): void {}
}