Table of Contents

Class VgnClient

Namespace
DotVgn.Client
Assembly
DotVgn.Client.dll

Default implementation of the VGN/VAG API client.

public sealed class VgnClient : ClientBase
Inheritance
VgnClient
Inherited Members

Constructors

VgnClient(ClientOptions?)

Client for accessing VAG/VGN-API.

public VgnClient(ClientOptions? options = null)

Parameters

options ClientOptions

Configuration options for the client.

VgnClient(HttpClient, IDepartureMapper, ITripMapper, IStationMapper)

Client for accessing VAG/VGN-API.

public VgnClient(HttpClient http, IDepartureMapper departureMapper, ITripMapper tripMapper, IStationMapper stationMapper)

Parameters

http HttpClient

The HTTP client used for requests.

departureMapper IDepartureMapper

The mapper for departures.

tripMapper ITripMapper

The mapper for trips.

stationMapper IStationMapper

The mapper for stations.

Methods

GetDeparturesAsync(DepartureQuery, CancellationToken)

Asynchronously retrieves a list of departures that match the specified DepartureQuery criteria.

public Task<IReadOnlyList<Departure>> GetDeparturesAsync(DepartureQuery query, CancellationToken cancellation = default)

Parameters

query DepartureQuery

The criteria used to filter and select departures. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyList<Departure>>

The task result contains a read-only list of Departure matching the query. The list will be empty if no departures are found.

GetDeparturesAsync(IEnumerable<DepartureQuery>, CancellationToken)

Asynchronously retrieves all departures that match the specified DepartureQuery lists criteria.

public Task<IReadOnlyList<(DepartureQuery Query, IReadOnlyList<Departure> Departures)>> GetDeparturesAsync(IEnumerable<DepartureQuery> queries, CancellationToken cancellation = default)

Parameters

queries IEnumerable<DepartureQuery>

The criteria used to filter and select departures. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyList<(DepartureQuery Query, IReadOnlyList<Departure> Departures)>>

The task result contains a tuple with the DepartureQuery> as a key and read-only list of Departure as value. The list will be empty if no departures are found.

GetStationsAsync(StationQuery, CancellationToken)

Asynchronously retrieves a list of stations that match the specified StationQuery criteria.

public Task<IReadOnlyList<Station>> GetStationsAsync(StationQuery query, CancellationToken cancellation = default)

Parameters

query StationQuery

The criteria used to filter and search for stations. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyList<Station>>

The task result contains a read-only list of Station matching the query. The list will be empty if no stations are found.

GetStationsAsync(IEnumerable<StationQuery>, CancellationToken)

Asynchronously retrieves all stations that match the specified StationQuery lists criteria.

public Task<IReadOnlyList<(StationQuery Query, IReadOnlyList<Station> Stations)>> GetStationsAsync(IEnumerable<StationQuery> queries, CancellationToken cancellation = default)

Parameters

queries IEnumerable<StationQuery>

The criteria used to filter and select stations. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyList<(StationQuery Query, IReadOnlyList<Station> Stations)>>

The task result contains a tuple with the StationQuery> as a key and read-only list of Station as value. The list will be empty if no stations are found.

GetTripAsync(TripQuery, CancellationToken)

Asynchronously retrieves a trip that matches the specified TripQuery criteria.

public Task<Trip> GetTripAsync(TripQuery query, CancellationToken cancellation = default)

Parameters

query TripQuery

The criteria used to filter and select trips. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<Trip>

The task result contains a Trip matching the query. Null if no trip was found.

GetTripsAsync(IEnumerable<TripQuery>, CancellationToken)

Asynchronously retrieves all trips that match the specified TripQuery lists criteria.

public Task<IReadOnlyList<(TripQuery Query, IReadOnlyList<Trip> Trips)>> GetTripsAsync(IEnumerable<TripQuery> queries, CancellationToken cancellation = default)

Parameters

queries IEnumerable<TripQuery>

The criteria used to filter and select trips. Cannot be null.

cancellation CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IReadOnlyList<(TripQuery Query, IReadOnlyList<Trip> Trips)>>

The task result contains a tuple with the TripQuery> as a key and read-only list of Trip as value. The list will be empty if no trips are found.