Client
using System;
using NuvTools.API.CPF;
 
namespace Company
{
public class CpfClientService
{
private readonly ApiCpfClient _apiCpfClient;
 
public CpfClientService(ApiCpfClient apiCpfClient)
{
_apiCpfClient = apiCpfClient;
}
 
public async Task> Find(CpfFilter cpfFilter)
{
var queryString = cpfFilter.GetQueryString();
return await _apiCpfClient.GetFromJsonAsync>(queryString);
}
}
}
Usage
namespace Company
{
public class Test
{
 
[Inject] private Company.CpfClientService CpfClientService { get; set; }
 
public async Task Test()
{
CpfFilter cpfFilter = new {
Cpf = "12345678910",
BirthDate = new DateTime(1,1,2001)
};
 
var resultCpf = await CpfClientService.Find(cpfFilter);
 
if(resultCpf.Succeeded)
Console.WriteLine(string.Format("CPF: {0} - BirthDate: {1}",
resultCpf.Data.Cpf,
resultCpf.Data.BirthDate.ToShortDateString()));
}
}
}