Aggiunta ricerca indirizzo
This commit is contained in:
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class AutoCompleteAddressDTO
|
||||
{
|
||||
[JsonPropertyName("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonPropertyName("placeId")]
|
||||
public string PlaceId { get; set; }
|
||||
}
|
||||
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class IndirizzoDTO
|
||||
{
|
||||
[JsonPropertyName("idPosizione")]
|
||||
public int IdPosizione { get; set; }
|
||||
|
||||
[JsonPropertyName("via")]
|
||||
public string? Via { get; set; }
|
||||
|
||||
[JsonPropertyName("numeroCivico")]
|
||||
public string? NumeroCivico { get; set; }
|
||||
|
||||
[JsonPropertyName("indirizzo")]
|
||||
public string? Indirizzo { get; set; }
|
||||
|
||||
[JsonPropertyName("cap")]
|
||||
public string? Cap { get; set; }
|
||||
|
||||
[JsonPropertyName("citta")]
|
||||
public string? Citta { get; set; }
|
||||
|
||||
[JsonPropertyName("prov")]
|
||||
public string? Prov { get; set; }
|
||||
|
||||
[JsonPropertyName("nazione")]
|
||||
public string? Nazione { get; set; }
|
||||
|
||||
[JsonPropertyName("lat")]
|
||||
public decimal? Lat { get; set; }
|
||||
|
||||
[JsonPropertyName("lng")]
|
||||
public decimal? Lng { get; set; }
|
||||
}
|
||||
@@ -16,4 +16,9 @@ public interface IIntegryApiService
|
||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||
Task SaveContact(CRMCreateContactRequestDTO request);
|
||||
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||
|
||||
//Google
|
||||
Task<List<IndirizzoDTO>?> Geocode(string address);
|
||||
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
|
||||
Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid);
|
||||
}
|
||||
@@ -74,4 +74,38 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
|
||||
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
||||
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
||||
|
||||
public Task<List<IndirizzoDTO>?> Geocode(string address)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{"address", address},
|
||||
{"retrieveAll", true}
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<List<IndirizzoDTO>>("geocode", queryParams);
|
||||
}
|
||||
|
||||
public Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{"address", address},
|
||||
{"language", language},
|
||||
{"uuid", uuid}
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<List<AutoCompleteAddressDTO>>("google/places/autoCompleteAddress", queryParams);
|
||||
}
|
||||
|
||||
public Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{ "placeId", placeId },
|
||||
{ "uuid", uuid }
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<IndirizzoDTO>("google/places/placeDetails", queryParams);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user