Refactor and expose more information
This commit was merged in pull request #1.
This commit is contained in:
19
HomeApi/Integration/GeocodingService.cs
Normal file
19
HomeApi/Integration/GeocodingService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using HomeApi.Integration.Client;
|
||||
using HomeApi.Models.Response;
|
||||
|
||||
namespace HomeApi.Integration;
|
||||
|
||||
public interface IGeocodingService
|
||||
{
|
||||
Task<NomatimApiResponse?> GetCoordinatesAsync(string address);
|
||||
}
|
||||
|
||||
public class GeocodingService(INominatimClient nominatimApi) : IGeocodingService
|
||||
{
|
||||
public async Task<NomatimApiResponse?> GetCoordinatesAsync(string address)
|
||||
{
|
||||
var results = await nominatimApi.SearchAsync(address);
|
||||
|
||||
return results.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user