PriceZ

The PriceZ client wrapper for .NET projects


Project maintained by guibranco Hosted on GitHub Pages — Theme by mattgraham

PriceZ [DEPRECATED]

2020-09-06: PriceZ is offline and so this package is deprecated!


The PriceZ .NET client wrapper.

CI/CD

Build status GitHub last commit GitHub last release GitHub license

Code Quality

Codacy Badge Codacy Badge Codecov Quality Gate Status Coverage

Maintainability Rating Lines of Code Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating Code Smells Bugs Vulnerabilities


Installation

PacakgeName NuGet Version PacakgeName NuGet Downloads Github All Releases

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


Features

Implements all features of PriceZ API available at PriceZ


Usage

PriceZClient instance


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);

Get area code


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);
}

Get states


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);
}

Get zip code data


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.