Table of Contents

Class TimetableClient

Namespace
DotBahn.Timetables
Assembly
DotBahn.Timetables.dll

Client for accessing 'Deutsche Bahn Timetables'-API.

public class TimetableClient : ClientBase, IDisposable, ITimetableClient
Inheritance
ClientBase
TimetableClient
Implements
Inherited Members
ClientBase.Dispose()
ClientBase.HttpClient

Constructors

TimetableClient(ClientOptions, AuthorizationOptions)

Client for accessing 'Deutsche Bahn Timetables'-API.

public TimetableClient(ClientOptions options, AuthorizationOptions auth)

Parameters

options ClientOptions

The options for this instance.

auth AuthorizationOptions

The auth credentials for the client.

Remarks

Creates and owns its own HttpClient. Dispose this instance to release it. Use only when instantiating manually without a DI container.

Exceptions

ArgumentNullException

Thrown when options is null.

ArgumentNullException

Thrown when auth is null.

Methods

GetFullChangesAsync(int, Timetable?, CancellationToken)

Gets full changes for a specific station. If a Timetable is supplied, the changes are merged onto this instance.

public Task<Timetable> GetFullChangesAsync(int eva, Timetable? mergeOn = null, CancellationToken cancellation = default)

Parameters

eva int

The EVA station number.

mergeOn Timetable

Current timetable on which these changes should apply.

cancellation CancellationToken

Token to cancel the request.

Returns

Task<Timetable>

A Timetable with full change information.

Exceptions

HttpRequestException

Thrown when non-success status codes occur.

GetRecentChangesAsync(int, Timetable?, CancellationToken)

Gets recent changes for a specific station. If a Timetable is supplied, the changes are merged onto this instance.

public Task<Timetable> GetRecentChangesAsync(int eva, Timetable? mergeOn = null, CancellationToken cancellation = default)

Parameters

eva int

The EVA station number.

mergeOn Timetable

Current timetable on which these changes should apply.

cancellation CancellationToken

Token to cancel the request.

Returns

Task<Timetable>

A Timetable with recent change information.

Exceptions

HttpRequestException

Thrown when non-success status codes occur.

GetTimetableAsync(int, DateTime, CancellationToken)

Gets the timetable for a specific station and time.

public Task<Timetable> GetTimetableAsync(int eva, DateTime dateTime, CancellationToken cancellation = default)

Parameters

eva int

The EVA station number.

dateTime DateTime

The date and hour (only YYMMDD/HH are used).

cancellation CancellationToken

Token to cancel the request.

Returns

Task<Timetable>

A Timetable for the specified hour.

Exceptions

HttpRequestException

Thrown when non-success status codes occur.