MichelMichels.BpostSharp.Web
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package MichelMichels.BpostSharp.Web --version 1.0.0
NuGet\Install-Package MichelMichels.BpostSharp.Web -Version 1.0.0
<PackageReference Include="MichelMichels.BpostSharp.Web" Version="1.0.0" />
paket add MichelMichels.BpostSharp.Web --version 1.0.0
#r "nuget: MichelMichels.BpostSharp.Web, 1.0.0"
// Install MichelMichels.BpostSharp.Web as a Cake Addin #addin nuget:?package=MichelMichels.BpostSharp.Web&version=1.0.0 // Install MichelMichels.BpostSharp.Web as a Cake Tool #tool nuget:?package=MichelMichels.BpostSharp.Web&version=1.0.0
<h1 align="center"> ✉️ BpostSharp </h1>
<br />
<div align="center"> This projects is a C# wrapper library to obtain Belgian city data from bpost (Belgian national mail service). </div>
<br /> <br />
<details> <summary>Table of Contents</summary>
</details>
Prerequisites
Building
Use Visual Studio 2022 to build the project.
Installation
Get the NuGet packages from nuget.org or search for MichelMichels.BpostSharp
in the GUI package manager in Visual Studio.
You can also use the cli of the package manager with following command:
Install-Package MichelMichels.BpostSharp
Install-Package MichelMichels.BpostSharp.Excel
Install-Package MichelMichels.BpostSharp.Web
<br /> <hr>
Getting started
There are 2 versions of BpostSharp:
Name | Nuget | Description |
---|---|---|
MichelMichels.BpostSharp.Excel |
<a href="https://www.nuget.org/packages/MichelMichels.BpostSharp.Excel"><img src="https://img.shields.io/nuget/v/MichelMichels.BpostSharp.Excel"/></a> | Excel cache (offline) |
MichelMichels.BpostSharp.Web |
<a href="https://www.nuget.org/packages/MichelMichels.BpostSharp.Web"><img src="https://img.shields.io/nuget/v/MichelMichels.BpostSharp.Web"/></a> | Html cache (online) |
These 2 versions have following dependency:
Name | Nuget | Description |
---|---|---|
MichelMichels.BpostSharp |
<a href="https://www.nuget.org/packages/MichelMichels.BpostSharp"><img src="https://img.shields.io/nuget/v/MichelMichels.BpostSharp"/></a> | This is the core package which contains all interfaces and models. |
Example code
Creating a web instance:
ICacheBuilder<CityData> webCacheBuilder = new WebCacheBuilder(BpostWebConstants.DutchEndpoint);
ICityDataService cityDataService = new BelgianCityDataService(webCacheBuilder);
Creating an excel instance:
ICacheBuilder<CityData> webCacheBuilder = new ExcelCacheBuilder("excel-from-bpost.xls");
ICityDataService cityDataService = new BelgianCityDataService(webCacheBuilder);
Querying data:
// Querying by postal code
CityData data = await cityDataService.GetByPostalCode("9000");
// Querying by city name
CityData data = await cityDataService.GetByCityName("Gent");
Code explanation
The querying uses StartsWith(...)
and ignores casing.
Data is saved into cache after executing Build()
on the ICacheBuilder
or after first query, whichever comes earlier. You can clear the cache with Clear()
.
Credits
Written by Michel Michels.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- AngleSharp (>= 1.0.7)
- MichelMichels.BpostSharp (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.