The PriceZ client wrapper for .NET projects
2020-09-06: PriceZ is offline and so this package is deprecated!
The PriceZ .NET client wrapper.
Download the latest zip file from the Release pages or simple install from NuGet package manager.
NuGet URL: https://www.nuget.org/packages/PriceZ
NuGet installation via Package Manager Console:
Install-Package PriceZ
Implements all features of PriceZ API available at PriceZ
var client = new HttpClient { BaseAddress = new Uri("https://ddd.pricez.com.br/") };
client.DefaultRequestHeaders.ExpectContinue = false;
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@"application/json"));
var priceZClient = new PriceZClient(client);
var myCancellationToken = new CancellationTokenSource().Token;
//use the client created previous
var areaCodes = await priceZClient.GetAreaCodesAsync(myCancellationToken);
foreach(var areaCode in areaCodes){
Console.WriteLine("Area code: {0}", areaCode);
var cities = await priceZClient.GetCitiesAssync(areaCode, myCancellationToken);
foreach(var city in cities)
Console.WriteLine("Area code: {0} | City: {1}", areaCode, city);
}
var myCancellationToken = new CancellationTokenSource().Token;
//use the client created previous
var states = await priceZClient.GetStatesAsync(myCancellationToken);
foreach(var state in states){
Console.WriteLine("State: {0}", state);
var cities = await priceZClient.GetCitiesAssync(state, myCancellationToken);
foreach(var city in cities)
Console.WriteLine("State: {0} | City: {1}", state, city);
}
var myCancellationToken = new CancellationTokenSource().Token;
//use the client created previous
var zipCode = await priceZClient.GetZipCodeAsync("01001000",myCancellationToken);
var neighborhood = zipCode.Neighborhood;
var ibgeCode = zipCode.CityInfo.IBGECode;
var cityName = zipCode.City;
//zipCode.CityInfo.Name should be null in the zip code search! User zipcode.City instead.