Table of Contents

Class StationQuery

Namespace
DotBahn.Stations
Assembly
DotBahn.Stations.dll

Represents the query parameters for searching stations. Provides fluent methods for convenient building of queries.

public sealed record StationQuery : IEquatable<StationQuery>
Inheritance
StationQuery
Implements
Inherited Members

Constructors

StationQuery()

public StationQuery()

Properties

Categories

Filter by station category. Single values (1-7), ranges (e.g., "2-4"), or comma-separated (e.g., "1,3-5").

public string? Categories { get; set; }

Property Value

string

Eva

The EVA station number used as a unique identifier.

public string? Eva { get; set; }

Property Value

string

Limit

The maximum number of hits to return. Default is 10_000.

public int Limit { get; set; }

Property Value

int

Names

Strings to search for station names. Wildcards '*' and '?' are supported.

public string[]? Names { get; set; }

Property Value

string[]

Offset

Offset of the first hit returned. Default is 0.

public int Offset { get; set; }

Property Value

int

Operator

Logical operator for combining multiple filters. Default is And.

public LogicalOperator Operator { get; set; }

Property Value

LogicalOperator

Ril

The RIL100 identifier of the station.

public string? Ril { get; set; }

Property Value

string

State

Filter by German federal state.

public FederalState? State { get; set; }

Property Value

FederalState?

Methods

CombineAs(LogicalOperator)

Sets the logical operator for combining multiple filters.

public StationQuery CombineAs(LogicalOperator @operator)

Parameters

operator LogicalOperator

Logical operator.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

Equals(StationQuery?)

public bool Equals(StationQuery? other)

Parameters

other StationQuery

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

InFederalState(FederalState)

Filters stations by federal state.

public StationQuery InFederalState(FederalState state)

Parameters

state FederalState

German federal state.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

LimitTo(int)

Sets the maximum number of results to return.

public StationQuery LimitTo(int limit)

Parameters

limit int

Maximum results.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

Skip(int)

Sets the number of results to skip for pagination.

public StationQuery Skip(int offset)

Parameters

offset int

Number of results to skip.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

ToString()

public override string ToString()

Returns

string

WithCategories(string)

Sets the station category filter. You can specify a single category, a range (e.g., "2-4") or a list of categories (e.g., "1,3-5"). Categories must be between 1 and 7.

public StationQuery WithCategories(string categories)

Parameters

categories string

One or more category specifications: integers, ranges, or comma-separated values.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

Exceptions

ArgumentException

Thrown if any category is invalid or out of range (1-7).

WithEva(string)

Filters stations by EVA number.

public StationQuery WithEva(string eva)

Parameters

eva string

EVA station number.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

WithNames(params string[])

Sets the station names or fragments to search for.

public StationQuery WithNames(params string[] names)

Parameters

names string[]

One or more station name patterns.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

Remarks

Appends a trailing '*' automatically if no wildcard is present.

Exceptions

ArgumentException

Thrown if no names are provided.

WithRil(string)

Filters stations by RIL100 identifier.

public StationQuery WithRil(string ril)

Parameters

ril string

RIL100 identifier.

Returns

StationQuery

The current StationQuery instance for fluent chaining.

Operators

operator ==(StationQuery?, StationQuery?)

public static bool operator ==(StationQuery? left, StationQuery? right)

Parameters

left StationQuery
right StationQuery

Returns

bool

operator !=(StationQuery?, StationQuery?)

public static bool operator !=(StationQuery? left, StationQuery? right)

Parameters

left StationQuery
right StationQuery

Returns

bool