RESTCountriesSharp 1.1.0

dotnet add package RESTCountriesSharp --version 1.1.0                
NuGet\Install-Package RESTCountriesSharp -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RESTCountriesSharp" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RESTCountriesSharp --version 1.1.0                
#r "nuget: RESTCountriesSharp, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RESTCountriesSharp as a Cake Addin
#addin nuget:?package=RESTCountriesSharp&version=1.1.0

// Install RESTCountriesSharp as a Cake Tool
#tool nuget:?package=RESTCountriesSharp&version=1.1.0                

RESTCountries Sharp

A .NET client wrapper for https://restcountries.com written in .NET Standard 2.0

Installation

Install the package via NuGet.

Usage

You can either create a new instance of RESTCountriesService or if you are using Dependency Injection there is also an interface called IRESTCountriesService which you can register in your container.

The service provides the following methods:

/// <summary>
///     Get all countries.
/// </summary>
Task<IEnumerable<Country>> GetAllCountriesAsync();

/// <summary>
///     Search by country name.
/// </summary>
Task<IEnumerable<Country>> GetCountriesByNameAsync(string name);

/// <summary>
///     Search by country's full name. 
///     It can be the common or official value
/// </summary>
Task<Country> GetCountryByFullNameAsync(string fullName);

/// <summary>
///     Search by cca2, ccn3, cca3 or cioc country code.
/// </summary>
Task<Country> GetCountryByCodeAsync(string code);

/// <summary>
///     Search by cca2, ccn3, cca3 or cioc country code.
/// </summary>
Task<IEnumerable<Country>> GetCountriesByCodesAsync(IEnumerable<string> codes);

/// <summary>
///     Search by currency code or name.
/// </summary>
Task<IEnumerable<Country>> GetCountriesByCurrencyAsync(string currency);

/// <summary>
///     Search by language code or name.
/// </summary>
Task<IEnumerable<Country>> GetCountriesByLanguageAsync(string language);

/// <summary>
///     Search by capital city
/// </summary>
Task<IEnumerable<Country>> GetCountriesByCapitalAsync(string capital);

/// <summary>
///     Search by region.
/// </summary>
Task<IEnumerable<Country>> GetCountriesByRegionAsync(string region);

/// <summary>
///     Search by subregions.
/// </summary>
Task<IEnumerable<Country>> GetCountriesBySubregionAsync(string subregion);

Sample

Here is a screenshot of the Console Application using the NuGet package to get the european countries and display them in a table on the console.

RESTCountriesSharpSample

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 267 10/23/2023
1.0.1 143 10/13/2023
1.0.0 135 9/15/2023

- Use REFIT for easier API requests