-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApi.php
More file actions
101 lines (93 loc) · 2.62 KB
/
Copy pathApi.php
File metadata and controls
101 lines (93 loc) · 2.62 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
98
99
100
101
<?php
namespace App\Controllers;
/**
* @OA\OpenApi(
* @OA\Info(title="CMDB API", version="3.0"),
* @OA\Server(
* description="API v2",
* url="/api/v2"
* ),
* security={{"JWTToken":{}}}
* )
*/
/**
* @OA\Tag(
* name="*system",
* description="Системные методы"
* )
*/
class Api extends ApiController
{
public function index()
{
return $this
->ResponceItem(
$this->app->version,
[]
);
}
/**
* Ping request
* @OA\Get(
* path="/ping",
* tags={"*system"},
* operationId="ping",
* security={},
* @OA\Response(
* response="200",
* description="Ping responce",
* @OA\JsonContent(
* allOf={
* @OA\Schema(ref="#/components/schemas/ResponceItem"),
* @OA\Schema(
* @OA\Property(property="message", type="string", default="pong"),
* @OA\Property(property="data", type="object",
* @OA\Property(
* property="version", type="string", default="0.0.0", description="API version"
* ),
* @OA\Property(
* property="ts", type="integer", default="12345678901", description="Server UnitTimeStamp"
* ),
* @OA\Property(
* property="date", type="string", default="31.12.2020", description="Server Date"
* ),
* @OA\Property(
* property="time", type="string", default="23:59:59", description="Server Time"
* )
* ),
* ),
* }
* ),
* )
* )
* @return Response
*/
public function ping()
{
return $this
->ResponceItem(
'pong',
[
'version' => $this->app->version,
'ts' => time(),
'date' => date('d.m.Y'),
'time' => date('H:i:s')
]
);
}
public function show404()
{
return $this
->ResponceError(
'not found'
);
}
public function cors()
{
return $this->ResponceCORS();
}
public function swagger()
{
return view('swagger');
}
}