Class TimetableClient
- Namespace
- DotBahn.Timetables
- Assembly
- DotBahn.Timetables.dll
Client for accessing 'Deutsche Bahn Timetables'-API.
public class TimetableClient : ClientBase, IDisposable, ITimetableClient
- Inheritance
-
ClientBaseTimetableClient
- 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
optionsClientOptionsThe options for this instance.
authAuthorizationOptionsThe 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
optionsisnull.- ArgumentNullException
Thrown when
authisnull.
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
evaintThe EVA station number.
mergeOnTimetableCurrent timetable on which these changes should apply.
cancellationCancellationTokenToken to cancel the request.
Returns
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
evaintThe EVA station number.
mergeOnTimetableCurrent timetable on which these changes should apply.
cancellationCancellationTokenToken to cancel the request.
Returns
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
evaintThe EVA station number.
dateTimeDateTimeThe date and hour (only YYMMDD/HH are used).
cancellationCancellationTokenToken to cancel the request.
Returns
Exceptions
- HttpRequestException
Thrown when non-success status codes occur.