diff --git a/sample/CountryData.Sample.Console/Program.cs b/sample/CountryData.Sample.Console/Program.cs
index 1f8e8d4..a4d4c20 100644
--- a/sample/CountryData.Sample.Console/Program.cs
+++ b/sample/CountryData.Sample.Console/Program.cs
@@ -1,4 +1,5 @@
-using CountryData.Standard;
+
+using CountryData.Standard;
///
/// Main program class for demonstrating the use of the CountryData library.
@@ -13,7 +14,7 @@ class Program
///
/// Entry point of the program.
///
- static void Main()
+ public static void Main()
{
GetCountries();
GetCountryByCode("US");
@@ -111,7 +112,7 @@ static void GetCountryByPhoneCode(string phoneCode)
Console.WriteLine($"Countries for phone code {phoneCode}:");
foreach (var country in countries)
{
- Console.WriteLine(country.CountryName);
+ Console.WriteLine(country.CountryName);
}
}
diff --git a/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs b/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
index 2707d24..7deec23 100644
--- a/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
+++ b/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
@@ -23,6 +23,8 @@ public CountryController(CountryHelper helper)
///
/// A list of all countries. If no countries are found, a NotFound result is returned.
[HttpGet]
+ [ProducesResponseType(typeof(IEnumerable), 200)]
+ [ProducesResponseType(404)]
public IActionResult GetCountries()
{
var countries = _helper.GetCountries();
@@ -41,6 +43,8 @@ public IActionResult GetCountries()
/// The ISO country code.
/// The data for the specified country. If no data is found, a NotFound result is returned.
[HttpGet("country")]
+ [ProducesResponseType(typeof(Country), 200)]
+ [ProducesResponseType(404)]
public IActionResult GetCountryByCode([FromQuery] string countryCode)
{
var country = _helper.GetCountryByCode(countryCode);
@@ -52,8 +56,6 @@ public IActionResult GetCountryByCode([FromQuery] string countryCode)
}
-
-
///
/// Returns comprehensive data for all countries.
///
@@ -62,6 +64,8 @@ public IActionResult GetCountryByCode([FromQuery] string countryCode)
/// If no data is found, a NotFound result is
[HttpGet("countries")]
+ [ProducesResponseType(typeof(IEnumerable), 200)]
+ [ProducesResponseType(404)]
public IActionResult GetCountryData()
{
var country = _helper.GetCountryData();
@@ -70,16 +74,18 @@ public IActionResult GetCountryData()
return NotFound();
}
return Ok(country);
-
}
+
///
/// Retrieves the regions for a given country code.
///
/// The ISO country code.
/// A list of regions for the specified country. If no regions are found, a NotFound result is returned.
[HttpGet("regions")]
+ [ProducesResponseType(typeof(IEnumerable), 200)]
+ [ProducesResponseType(404)]
public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
{
var regions = _helper.GetRegionByCountryCode(countryCode);
@@ -91,21 +97,21 @@ public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
}
-
///
/// Retrieves the emoji flag for a given country short code.
///
/// The short code of the country.
/// The emoji flag for the specified country. If no flag is found, a NotFound result is returned.
[HttpGet("flag")]
- public IActionResult GetCountryFlag([FromQuery] string shortCode)
+ [ProducesResponseType(typeof(string), 200)]
+ [ProducesResponseType(404)]
+ public IActionResult GetCountryFlag([FromQuery] string countryCode)
{
- var flag = _helper.GetCountryEmojiFlag(shortCode);
+ var flag = _helper.GetCountryEmojiFlag(countryCode);
if (flag == null)
{
return NotFound();
}
-
return Ok(flag);
}
@@ -116,14 +122,15 @@ public IActionResult GetCountryFlag([FromQuery] string shortCode)
/// The short code of the country.
/// The phone code for the specified country. If no phone code is found, a NotFound result is returned.
[HttpGet("phoneCodeByShortCode")]
- public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string shortCode)
+ [ProducesResponseType(typeof(string), 200)]
+ [ProducesResponseType(404)]
+ public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string countryCode)
{
- var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
+ var phoneCode = _helper.GetPhoneCodeByCountryShortCode(countryCode);
if (phoneCode == null)
{
return NotFound();
}
-
return Ok(phoneCode);
}
@@ -133,6 +140,8 @@ public IActionResult GetPhoneCodeByCountryShortCode([FromQuery] string shortCode
/// The phone code of the country.
/// The data for the specified country. If no data is found, a NotFound result is returned.
[HttpGet("countryByPhoneCode")]
+ [ProducesResponseType(typeof(Country), 200)]
+ [ProducesResponseType(404)]
public IActionResult GetCountryByPhoneCode([FromQuery] string phoneCode)
{
var countryDataByPhoneCode = _helper.GetCountriesByPhoneCode(phoneCode);
@@ -140,7 +149,6 @@ public IActionResult GetCountryByPhoneCode([FromQuery] string phoneCode)
{
return NotFound();
}
-
return Ok(countryDataByPhoneCode);
}
diff --git a/sample/CountryData.Sample.Web.API/CountryData.Sample.Web.API.http b/sample/CountryData.Sample.Web.API/CountryData.Sample.Web.API.http
index 6df1d6c..e69de29 100644
--- a/sample/CountryData.Sample.Web.API/CountryData.Sample.Web.API.http
+++ b/sample/CountryData.Sample.Web.API/CountryData.Sample.Web.API.http
@@ -1,41 +0,0 @@
-@CountryInforAPI_HostAddress = http://localhost:5016
-
-# Retrieves the default country information
-GET {{CountryInforAPI_HostAddress}}/Country
-Accept: application/json
-
-###
-
-# Retrieves a list of all countries
-GET {{CountryInforAPI_HostAddress}}/Country/countries
-Accept: application/json
-
-###
-
-# Retrieves the regions for the country with the code 'US'
-GET {{CountryInforAPI_HostAddress}}/Country/US/regions
-Accept: application/json
-
-###
-
-# Retrieves the country information for the country with the code 'GH'
-GET {{CountryInforAPI_HostAddress}}/Country/GH/countries
-Accept: application/json
-
-###
-
-# Retrieves the emoji flag for the country with the code 'US'
-GET {{CountryInforAPI_HostAddress}}/Country/US/flag
-Accept: application/json
-
-###
-# Retrieves the phone code for the country with the code 'US'
-GET {{CountryInforAPI_HostAddress}}/Country/GH/phoneCode
-Accept: application/json
-
-###
-# Retrieves the country information for the country with the phone code '1'
-GET {{CountryInforAPI_HostAddress}}/Country/phoneCode/+233
-Accept: application/json
-
-###
diff --git a/src/CountryData.Standard/CountryData.Standard.csproj b/src/CountryData.Standard/CountryData.Standard.csproj
index f31b878..c4f9454 100644
--- a/src/CountryData.Standard/CountryData.Standard.csproj
+++ b/src/CountryData.Standard/CountryData.Standard.csproj
@@ -11,7 +11,6 @@
1.4.0
true
MIT
- readme.md
Added new functionality to get country phone codes
@@ -25,6 +24,8 @@
+
+