Pandorax.Loqate
0.0.0-alpha003
See the version list below for details.
dotnet add package Pandorax.Loqate --version 0.0.0-alpha003
NuGet\Install-Package Pandorax.Loqate -Version 0.0.0-alpha003
<PackageReference Include="Pandorax.Loqate" Version="0.0.0-alpha003" />
paket add Pandorax.Loqate --version 0.0.0-alpha003
#r "nuget: Pandorax.Loqate, 0.0.0-alpha003"
// Install Pandorax.Loqate as a Cake Addin #addin nuget:?package=Pandorax.Loqate&version=0.0.0-alpha003&prerelease // Install Pandorax.Loqate as a Cake Tool #tool nuget:?package=Pandorax.Loqate&version=0.0.0-alpha003&prerelease
Pandorax.Loqate
Pandorax.Loqate is a .NET library that provides easy integration with the Loqate API for address verification, geocoding, and other location-based services.
Table of Contents
Getting Started
Prerequisites
An API key is needed from Loqate
Installation
You can install Pandorax.Loqate via NuGet Package Manager or .NET CLI.
NuGet Package Manager:
Install-Package Pandorax.Loqate
.NET CLI:
dotnet add package Pandorax.Loqate
Usage
To get started using Pandorax.Loqate, follow these steps:
Configuration
Make sure to have the API key available to your application configuration, whether it be in your user secrets, appsettings.json, or another configuration provider you have configured.
Adding Services to Dependency Injection Container
To use Pandorax.Loqate with dependency injection, you need to register the required services in your application's dependency injection container.
Example for ASP.NET Core:
In an ASP.NET Core application's Program.cs
, add the following code after initialising the WebApplicationBuilder
:
builder.Services
.Configure<LoqateOptions>(options =>
{
options.Key = builder.Configuration["Loqate:ApiKey"];
})
.AddLoqate();
Injecting the Loqate Service
Once you have registered the LoqateService with the dependency injection container, you can inject it into your classes where needed.
Example Usage in a Controller:
using Pandorax.Loqate;
[ApiController]
[Route("[controller]")]
public class AddressController : ControllerBase
{
private readonly ILoqateService _loqateService;
public AddressController(ILoqateService loqateService)
{
_loqateService = loqateService;
}
[HttpGet]
public async Task<IActionResult> FindAddresses(string text)
{
FindRequestParameters requestParameters = new(text)
{
Countries = ["GB"]
};
FindResponse addresses = await _loqateService.FindAddressesAsync(requestParameters);
return Ok(addresses);
}
}
In this example, the ILoqateService
is injected into the AddressController
, allowing the controller to use the Loqate service for address lookup.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.AspNetCore.WebUtilities (>= 8.0.5)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
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 |
---|---|---|
0.0.0-alpha004 | 209 | 5/16/2024 |
0.0.0-alpha003 | 60 | 5/16/2024 |
0.0.0-alpha002 | 60 | 5/15/2024 |
0.0.0-alpha001 | 65 | 5/15/2024 |