@@ -23,6 +23,8 @@ public CountryController(CountryHelper helper)
2323 /// </summary>
2424 /// <returns>A list of all countries. If no countries are found, a NotFound result is returned.</returns>
2525 [ HttpGet ]
26+ [ ProducesResponseType ( typeof ( IEnumerable < Country > ) , 200 ) ]
27+ [ ProducesResponseType ( 404 ) ]
2628 public IActionResult GetCountries ( )
2729 {
2830 var countries = _helper . GetCountries ( ) ;
@@ -41,6 +43,8 @@ public IActionResult GetCountries()
4143 /// <param name="countryCode">The ISO country code.</param>
4244 /// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
4345 [ HttpGet ( "country" ) ]
46+ [ ProducesResponseType ( typeof ( Country ) , 200 ) ]
47+ [ ProducesResponseType ( 404 ) ]
4448 public IActionResult GetCountryByCode ( [ FromQuery ] string countryCode )
4549 {
4650 var country = _helper . GetCountryByCode ( countryCode ) ;
@@ -52,8 +56,6 @@ public IActionResult GetCountryByCode([FromQuery] string countryCode)
5256 }
5357
5458
55-
56-
5759 /// <summary>
5860 /// Returns comprehensive data for all countries.
5961 /// </summary>
@@ -62,6 +64,8 @@ public IActionResult GetCountryByCode([FromQuery] string countryCode)
6264 /// If no data is found, a NotFound result is
6365
6466 [ HttpGet ( "countries" ) ]
67+ [ ProducesResponseType ( typeof ( IEnumerable < Country > ) , 200 ) ]
68+ [ ProducesResponseType ( 404 ) ]
6569 public IActionResult GetCountryData ( )
6670 {
6771 var country = _helper . GetCountryData ( ) ;
@@ -70,16 +74,18 @@ public IActionResult GetCountryData()
7074 return NotFound ( ) ;
7175 }
7276 return Ok ( country ) ;
73-
7477 }
7578
7679
80+
7781 /// <summary>
7882 /// Retrieves the regions for a given country code.
7983 /// </summary>
8084 /// <param name="countryCode">The ISO country code.</param>
8185 /// <returns>A list of regions for the specified country. If no regions are found, a NotFound result is returned.</returns>
8286 [ HttpGet ( "regions" ) ]
87+ [ ProducesResponseType ( typeof ( IEnumerable < Regions > ) , 200 ) ]
88+ [ ProducesResponseType ( 404 ) ]
8389 public IActionResult GetRegionsByCountryCode ( [ FromQuery ] string countryCode )
8490 {
8591 var regions = _helper . GetRegionByCountryCode ( countryCode ) ;
@@ -91,21 +97,21 @@ public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
9197 }
9298
9399
94-
95100 /// <summary>
96101 /// Retrieves the emoji flag for a given country short code.
97102 /// </summary>
98103 /// <param name="shortCode">The short code of the country.</param>
99104 /// <returns>The emoji flag for the specified country. If no flag is found, a NotFound result is returned.</returns>
100105 [ HttpGet ( "flag" ) ]
101- public IActionResult GetCountryFlag ( [ FromQuery ] string shortCode )
106+ [ ProducesResponseType ( typeof ( string ) , 200 ) ]
107+ [ ProducesResponseType ( 404 ) ]
108+ public IActionResult GetCountryFlag ( [ FromQuery ] string countryCode )
102109 {
103- var flag = _helper . GetCountryEmojiFlag ( shortCode ) ;
110+ var flag = _helper . GetCountryEmojiFlag ( countryCode ) ;
104111 if ( flag == null )
105112 {
106113 return NotFound ( ) ;
107114 }
108-
109115 return Ok ( flag ) ;
110116 }
111117
@@ -116,14 +122,15 @@ public IActionResult GetCountryFlag([FromQuery] string shortCode)
116122 /// <param name="shortCode">The short code of the country.</param>
117123 /// <returns>The phone code for the specified country. If no phone code is found, a NotFound result is returned.</returns>
118124 [ HttpGet ( "phoneCodeByShortCode" ) ]
119- public IActionResult GetPhoneCodeByCountryShortCode ( [ FromQuery ] string shortCode )
125+ [ ProducesResponseType ( typeof ( string ) , 200 ) ]
126+ [ ProducesResponseType ( 404 ) ]
127+ public IActionResult GetPhoneCodeByCountryShortCode ( [ FromQuery ] string countryCode )
120128 {
121- var phoneCode = _helper . GetPhoneCodeByCountryShortCode ( shortCode ) ;
129+ var phoneCode = _helper . GetPhoneCodeByCountryShortCode ( countryCode ) ;
122130 if ( phoneCode == null )
123131 {
124132 return NotFound ( ) ;
125133 }
126-
127134 return Ok ( phoneCode ) ;
128135 }
129136
@@ -133,14 +140,15 @@ public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string shortCode
133140 /// <param name="phoneCode">The phone code of the country.</param>
134141 /// <returns>The data for the specified country. If no data is found, a NotFound result is returned.</returns>
135142 [ HttpGet ( "countryByPhoneCode" ) ]
143+ [ ProducesResponseType ( typeof ( Country ) , 200 ) ]
144+ [ ProducesResponseType ( 404 ) ]
136145 public IActionResult GetCountryByPhoneCode ( [ FromQuery ] string phoneCode )
137146 {
138147 var countryDataByPhoneCode = _helper . GetCountriesByPhoneCode ( phoneCode ) ;
139148 if ( countryDataByPhoneCode == null )
140149 {
141150 return NotFound ( ) ;
142151 }
143-
144152 return Ok ( countryDataByPhoneCode ) ;
145153 }
146154
0 commit comments