Class VgnClient
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
optionsClientOptionsConfiguration 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
httpHttpClientThe HTTP client used for requests.
departureMapperIDepartureMapperThe mapper for departures.
tripMapperITripMapperThe mapper for trips.
stationMapperIStationMapperThe 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
queryDepartureQueryThe criteria used to filter and select departures. Cannot be null.
cancellationCancellationTokenA 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
queriesIEnumerable<DepartureQuery>The criteria used to filter and select departures. Cannot be null.
cancellationCancellationTokenA 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
queryStationQueryThe criteria used to filter and search for stations. Cannot be null.
cancellationCancellationTokenA 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
queriesIEnumerable<StationQuery>The criteria used to filter and select stations. Cannot be null.
cancellationCancellationTokenA 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
queryTripQueryThe criteria used to filter and select trips. Cannot be null.
cancellationCancellationTokenA cancellation token that can be used to cancel the asynchronous operation.
Returns
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
queriesIEnumerable<TripQuery>The criteria used to filter and select trips. Cannot be null.
cancellationCancellationTokenA 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.