11<?php namespace App \Http \Controllers ;
2+
23/**
34 * Copyright 2021 OpenStack Foundation
45 * Licensed under the Apache License, Version 2.0 (the "License");
1718use models \exceptions \EntityNotFoundException ;
1819use models \exceptions \ValidationException ;
1920use utils \PagingResponse ;
21+ use OpenApi \Attributes as OA ;
22+ use Symfony \Component \HttpFoundation \Response ;
23+
2024/**
2125 * Class TimezonesApiController
2226 * @package App\Http\Controllers
@@ -26,6 +30,80 @@ final class TimezonesApiController extends JsonController
2630 /**
2731 * @return mixed
2832 */
33+ #[OA \Get(
34+ path: '/api/v1/timezones ' ,
35+ operationId: 'getTimezones ' ,
36+ description: 'Retrieve all available timezones ' ,
37+ tags: ['Timezones ' ],
38+ parameters: [
39+ new OA \Parameter (
40+ name: 'expand ' ,
41+ description: 'Expansion parameters ' ,
42+ in: 'query ' ,
43+ required: false ,
44+ schema: new OA \Schema (type: 'string ' )
45+ ),
46+ new OA \Parameter (
47+ name: 'page ' ,
48+ description: 'Page number ' ,
49+ in: 'query ' ,
50+ required: false ,
51+ schema: new OA \Schema (type: 'integer ' , default: 1 )
52+ ),
53+ new OA \Parameter (
54+ name: 'per_page ' ,
55+ description: 'Items per page ' ,
56+ in: 'query ' ,
57+ required: false ,
58+ schema: new OA \Schema (type: 'integer ' , default: 10 )
59+ ),
60+ ],
61+ responses: [
62+ new OA \Response (
63+ response: Response::HTTP_OK ,
64+ description: 'List of timezones ' ,
65+ content: new OA \JsonContent (
66+ properties: [
67+ new OA \Property (
68+ property: 'data ' ,
69+ type: 'array ' ,
70+ items: new OA \Items (
71+ type: 'string ' ,
72+ example: 'America/New_York '
73+ ),
74+ description: 'Array of timezone identifiers '
75+ ),
76+ new OA \Property (
77+ property: 'total ' ,
78+ type: 'integer ' ,
79+ description: 'Total number of timezones ' ,
80+ example: 427
81+ ),
82+ new OA \Property (
83+ property: 'page ' ,
84+ type: 'integer ' ,
85+ description: 'Current page number ' ,
86+ example: 1
87+ ),
88+ new OA \Property (
89+ property: 'last_page ' ,
90+ type: 'integer ' ,
91+ description: 'Last page number ' ,
92+ example: 1
93+ ),
94+ ]
95+ )
96+ ),
97+ new OA \Response (
98+ response: Response::HTTP_PRECONDITION_FAILED ,
99+ description: 'Validation Error '
100+ ),
101+ new OA \Response (
102+ response: Response::HTTP_INTERNAL_SERVER_ERROR ,
103+ description: 'Server Error '
104+ ),
105+ ]
106+ )]
29107 public function getAll (){
30108 try {
31109 $ timezones = \DateTimeZone::listIdentifiers ();
0 commit comments