AcceptRouterTompSdk 1.0.3

dotnet add package AcceptRouterTompSdk --version 1.0.3
                    
NuGet\Install-Package AcceptRouterTompSdk -Version 1.0.3
                    
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="AcceptRouterTompSdk" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AcceptRouterTompSdk" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="AcceptRouterTompSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AcceptRouterTompSdk --version 1.0.3
                    
#r "nuget: AcceptRouterTompSdk, 1.0.3"
                    
#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.
#:package AcceptRouterTompSdk@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AcceptRouterTompSdk&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=AcceptRouterTompSdk&version=1.0.3
                    
Install as a Cake Tool

C# SDK for ACCEPT.ROUTER

A C# SDK to connect with the ACCEPT.ROUTER via the Transport Operator MaaS Provider (TOMP) API, version 1.3.0. This library provides C# classes and models based on the OpenAPI specification to facilitate integration with TOMP-compliant services.

Overview

The ACCEPT.ROUTER connects national and/or regional ticketing systems, making multi-modal and cross-border traveling possible. The router consists of a transaction functionality and a many-to-many functionality based upon the TOMP-API. For more details, see the Wiki-page. The TOMP API is an API between MaaS Providers and Transport Operators for planning and booking trips and corresponding assets. For more details on the TOMP-API visit the TOMP-WG GitHub repository. This SDK simplifies the connection with the ACCEPT.ROUTER and implementation of TOMP clients and servers in C# applications.

Onboarding

In order to start connecting to the MaaS-NL-Server send in an application to maasadministrator@acceptinstitute.eu with the following information:

Field Value
Name of the Company (MSP) [company name]
Address [street name & number, zip code, city]
Contact Person [name of person(s) to contact, including role]
Contact Details [email, phone number]

Requirements

  • .NET 8.0 or higher

Installation

Install the NuGet package into your project:

dotnet add package AcceptRouterTompSdk

Or, add the PackageReference to your .csproj file:

<ItemGroup>
    <PackageReference Include="AcceptRouterTompSdk" Version="1.0.3" />
</ItemGroup>

Dependencies

This project relies on the following key dependencies:

  • Microsoft.Extensions.Http: For resilient HttpClient management.
  • Microsoft.Extensions.Http.Polly: For advanced transient fault handling (retries, circuit breakers).
  • Microsoft.Extensions.Hosting: For standard dependency injection and logging abstractions.
  • Microsoft.Net.Http.Headers: For typed HTTP header management.

Note: JSON processing is handled via the built-in System.Text.Json library.

Outgoing requests

Usage

The main entry point for the SDK is the Tomp interface. You can create a TransportOperatorsApi instance using the builder pattern, which integrates directly with your IServiceCollection.

Example: Initialization and Ping
using System;
using System.Globalization;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using AcceptRouterTompSdk;
using AcceptRouterTompSdk.Model;
using AcceptRouterTompSdk.Exceptions;
using Microsoft.Extensions.DependencyInjection;

public class TompExample
{
    public static async Task Main(string[] args)
    {
        var services = new ServiceCollection();

        // Load your certificates
        var selfSignedCert = new X509Certificate2("my-client-cert.pfx", "password");
        var routerCert = new X509Certificate2("router-public-cert.cer");

        // Use the builder to register services
        Tomp.Builder()
            .TompUrl(new Uri("https://router.acceptinstitute.eu/"))
            .SelfSignedCertificate(selfSignedCert)
            .RouterCertificate(routerCert)
            .ApiDescription("TOMP-SDK")
            .ApiVersion(new SemVer(1, 3, 0))
            .AddLanguageTag(new CultureInfo("en-US"))
            .RegisterTransportOperatorApi(services, "your-maas-id");

        var serviceProvider = services.BuildServiceProvider();
        var api = serviceProvider.GetRequiredService<ITransportOperatorsApi>();

        try
        {
            await api.Ping("target-operator-id");
            Console.WriteLine("Successfully connected to the router.");
        }
        catch (MaliciousResponseException ex)
        {
            Console.WriteLine($"Security Validation Failed: {ex.Message}");
        }
        catch (TompException ex)
        {
            Console.WriteLine($"TOMP API Error: {ex.Message}");
        }
    }
}

The model classes are located in the AcceptRouterTompSdk.Model namespace. You can use these classes to construct requests and handle responses.

Incoming requests

Usage

This SDK can be used for the DTOs for incoming requests and outgoing responses. The model classes are located in the AcceptRouterTompSdk.Model namespace.

The SDK also provides middleware-classes for validating incoming signatures with the SignatureValidationMiddleware-class and signing responses with the ResponseSignatureMiddleware-class. For ease of use the extension methods WebApplicationBuilder.AddSignatureMiddlewareHelpers() and IApplicationBuilder.AddRouterMiddleware() are provided.

Example: Registering Middleware
public class Program
{
    public static void Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);

        builder.AddSignatureMiddlewareHelpers();

        var app = builder.Build();
        
        app.UseWhen(
            httpContext => httpContext.Request.Path.StartsWithSegments("TOMP"),
            branch => branch.AddRouterMiddleware()
        );
    }
}

Documentation

The OpenAPI specification of TOMP 1.3.0 is available through Swagger.

Documentation of the ACCEPT.ROUTER is available on the ACCEPT. wiki

Access can be requested by mailing maasadministrator@acceptinstitute.eu

License

This project is licensed under the European Union Public Licence v. 1.2 (EUPL-1.2). See the LICENSE file for details.

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 175 8/3/2026
1.0.1 149 4/22/2026
1.0.0 103 4/7/2026

Processed user tests