Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
medziane committed Jan 2, 2025
1 parent 1c93c77 commit 5e09a6f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The CountryLayer SDK for .NET is a library that allows you to access the CountryLayer API from your .NET application. The CountryLayer API is a RESTful web service that provides a way to look up information about countries.

## Prerequisites
- You need a CountryLayer API key. You can get one for free at [https://countrylayer.com](https://countrylayer.com).
- You need a CountryLayer API key. You can get one for free (or paid) at [https://countrylayer.com](https://countrylayer.com).

## Usage
The CountryLayer SDK for .NET is available as a [NuGet package](https://www.nuget.org/packages/CountryLayer/). You can install it using the following command:
Expand All @@ -15,5 +15,39 @@ Here is an example of how you can use the SDK to look up information about a cou

```csharp
ICountryLayer countryLayer = new CountryLayer(apiKey);
var country = await countryLayer.GetCountriesByCurrency("usd", CancellationToken.None);
List<Country> countries = await countryLayer.GetCountriesByCurrency("usd", CancellationToken.None);
```

## Documentation
The CountryLayer SDK for .NET is a thin wrapper around the CountryLayer API.

### ICountryLayer
The `ICountryLayer` interface defines the methods that you can use to access the CountryLayer API.

#### Methods
- `GetAllCountries(CancellationToken cancellationToken)`: Gets a list of all countries.
- `GetAllCountries(string filters, CancellationToken cancellationToken)`: Gets a list of all countries but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByName(string name, CancellationToken cancellationToken)`: Gets a list of countries by name.
- `GetCountriesByName(string name, string filters, CancellationToken cancellationToken)`: Gets a list of countries by name but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByName(string name, bool fullText, CancellationToken cancellationToken)`: Gets a list of countries by name using full-text search.
- `GetCountriesByName(string name, bool fullText, string filters, CancellationToken cancellationToken)`: Gets a list of countries by name using full-text search but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByCapital(string capital, CancellationToken cancellationToken)`: Gets a list of countries by capital.
- `GetCountriesByCapital(string capital, string filters, CancellationToken cancellationToken)`: Gets a list of countries by capital but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByLanguage(string language, CancellationToken cancellationToken)`: Gets a list of countries by language.
- `GetCountriesByLanguage(string language, string filters, CancellationToken cancellationToken)`: Gets a list of countries by language but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByCurrency(string currency, CancellationToken cancellationToken)`: Gets a list of countries by currency.
- `GetCountriesByCurrency(string currency, string filters, CancellationToken cancellationToken)`: Gets a list of countries by currency but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByRegion(string region, CancellationToken cancellationToken)`: Gets a list of countries by region.
- `GetCountriesByRegion(string region, string filters, CancellationToken cancellationToken)`: Gets a list of countries by region but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByRegionalBlock(string regionalBlock, CancellationToken cancellationToken)`: Gets a list of countries by regional block.
- `GetCountriesByRegionalBlock(string regionalBlock, string filters, CancellationToken cancellationToken)`: Gets a list of countries by regional block but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByCallingCode(string callingCode, CancellationToken cancellationToken)`: Gets a list of countries by calling code.
- `GetCountriesByCallingCode(string callingCode, string filters, CancellationToken cancellationToken)`: Gets a list of countries by calling code but returns only the data corresponding to the keys specified in filters.
- `GetCountriesByAlphaCode(string alphaCode, CancellationToken cancellationToken)`: Gets a list of countries by alpha code.
- `GetCountriesByAlphaCode(string alphaCode, string filters, CancellationToken cancellationToken)`: Gets a list of countries by alpha code but returns only the data corresponding to the keys specified in filters.

For more information about the API, see the [CountryLayer API documentation](https://countrylayer.com/documentation).

## License
This project is licensed under the MIT License. See the [LICENSE](https://github.com/medziane/countrylayer/blob/main/LICENSE) file for more information.

2 changes: 1 addition & 1 deletion sample/CountryLayer.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

ICountryLayer countryLayer = new CountryLayer(apiKey);
var filters = "name;alpha2Code";
var countries = await countryLayer.GetAllCountries(filters, CancellationToken.None);
List<Country> countries = await countryLayer.GetAllCountries(filters, CancellationToken.None);

foreach (var country in countries)
{
Expand Down

0 comments on commit 5e09a6f

Please sign in to comment.