MichelMichels.BpostSharp 1.0.2

dotnet add package MichelMichels.BpostSharp --version 1.0.2                
NuGet\Install-Package MichelMichels.BpostSharp -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MichelMichels.BpostSharp" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MichelMichels.BpostSharp --version 1.0.2                
#r "nuget: MichelMichels.BpostSharp, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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 Downloads Last updated
1.0.2 528 5/13/2024
1.0.1 590 1/15/2024
1.0.0 125 1/13/2024

* Version bump