MichelMichels.BpostSharp
1.0.2
dotnet add package MichelMichels.BpostSharp --version 1.0.2
NuGet\Install-Package MichelMichels.BpostSharp -Version 1.0.2
<PackageReference Include="MichelMichels.BpostSharp" Version="1.0.2" />
paket add MichelMichels.BpostSharp --version 1.0.2
#r "nuget: MichelMichels.BpostSharp, 1.0.2"
// Install MichelMichels.BpostSharp as a Cake Addin #addin nuget:?package=MichelMichels.BpostSharp&version=1.0.2 // Install MichelMichels.BpostSharp as a Cake Tool #tool nuget:?package=MichelMichels.BpostSharp&version=1.0.2
BpostSharp ✉️
This projects is a C# wrapper library to obtain Belgian city data from bpost (Belgian national mail service).
<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 one of following commands:
Install-Package MichelMichels.BpostSharp.Excel
Install-Package MichelMichels.BpostSharp.Web
Above commands will also add a dependency to MichelMichels.BpostSharp
. This nuget package contains the core code.
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. |
To use the excel version, use any version of the files at the official bpost website. To use the web version, grab one of the HTML versions on the same page.
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
List<CityData> data = await cityDataService.GetByPostalCode("9000");
// Querying by city name
List<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
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MichelMichels.BpostSharp:
Package | Downloads |
---|---|
MichelMichels.BpostSharp.Excel
Package Description |
|
MichelMichels.BpostSharp.Web
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
* Version bump