forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpeedtestAnnotations.php
More file actions
97 lines (93 loc) · 3.53 KB
/
SpeedtestAnnotations.php
File metadata and controls
97 lines (93 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace App\OpenApi\Annotations\V1;
use Illuminate\Http\Response;
use OpenApi\Attributes as OA;
#[OA\Tag(
name: 'Speedtests',
description: 'Endpoints for running speedtests and listing servers.'
)]
class SpeedtestAnnotations
{
#[OA\Post(
path: '/api/v1/speedtests/run',
summary: 'Run a new Ookla speedtest',
operationId: 'runSpeedtest',
tags: ['Speedtests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/AcceptHeader'),
new OA\Parameter(
name: 'server_id',
in: 'query',
description: 'Optional Ookla speedtest server ID',
required: false,
schema: new OA\Schema(type: 'integer')
),
],
responses: [
new OA\Response(
response: Response::HTTP_CREATED,
description: 'Created',
content: new OA\JsonContent(ref: '#/components/schemas/SpeedtestRun')
),
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 run(): void
{
// Annotation placeholder for runSpeedtest
}
#[OA\Get(
path: '/api/v1/speedtests/list-servers',
summary: 'List available Ookla speedtest servers',
operationId: 'listSpeedtestServers',
tags: ['Speedtests'],
parameters: [
new OA\Parameter(ref: '#/components/parameters/AcceptHeader'),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'OK',
content: new OA\JsonContent(ref: '#/components/schemas/ServersCollection')
),
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',
example: ['message' => 'You do not have permission to view speedtest servers.']
)
),
new OA\Response(
response: Response::HTTP_NOT_ACCEPTABLE,
description: 'Not Acceptable - Missing or invalid Accept header',
content: new OA\JsonContent(ref: '#/components/schemas/NotAcceptableError')
),
]
)]
public function listServers(): void {}
}