export type Area = { /** Name of the area */ name: string; /** {@link https://wiki.openstreetmap.org/wiki/Key:admin_level OpenStreetMap `admin_level`} of the area */ adminLevel: number; /** Whether this area was matched by the input text */ matched: boolean; /** Set for the first area after the `default` area that distinguishes areas if the match is ambiguous regarding (`default` area + place name / street [+ house number]). */ unique: boolean; /** Whether this area should be displayed as default area (area with admin level closest 7) */ default: boolean; }; export type Match = { /** location type */ type: 'ADDRESS' | 'PLACE' | 'STOP'; /** list of non-overlapping tokens that were matched */ tokens: number[][]; /** name of the location (transit stop / PoI / address) */ name: string; /** unique id of the location */ id: string; /** latitude */ lat: number; /** longitude */ lon: number; /** level according to OpenStreetMap (at the moment only for public transport) */ level?: number; /** street name */ street?: string; /** house number */ houseNumber?: string; /** zip code */ zip?: string; /** list of areas */ areas: Area[]; }; export enum Mode { // street // Walk = 'WALK', Bike = 'BIKE', /** Experimental. Expect unannounced breaking changes (without version bumps) for all parameters and returned structs. */ Rental = 'RENTAL', Car = 'CAR', /** Experimental. Expect unannounced breaking changes (without version bumps) for all parameters and returned structs. */ CarParking = 'CAR_PARKING', /** Experimental. Expect unannounced breaking changes (without version bumps) for all parameters and returned structs. */ CarDropoff = 'CAR_DROPOFF', /** on-demand taxis from the Prima+ÖV Project */ ODM = 'ODM', /** flexible transports */ Flex = 'FLEX', // transit // /** translates to `RAIL,TRAM,BUS,FERRY,AIRPLANE,COACH,CABLE_CAR,FUNICULAR,AREAL_LIFT,OTHER` */ Transit = 'TRANSIT', /** trams */ Tram = 'TRAM', /** subway trains */ Subway = 'SUBWAY', /** ferries */ Ferry = 'FERRY', /** airline flights */ Airplane = 'AIRPLANE', /** metro trains */ Metro = 'METRO', /** short distance buses (does not include `COACH`) */ Bus = 'BUS', /** long distance buses (does not include `BUS`) */ Coach = 'COACH', /** translates to `HIGHSPEED_RAIL,LONG_DISTANCE,NIGHT_RAIL,REGIONAL_RAIL,REGIONAL_FAST_RAIL,METRO,SUBWAY` */ Rail = 'RAIL', /** long distance high speed trains (e.g. TGV, ICE) */ HighspeedRail = 'HIGHSPEED_RAIL', /** long distance inter city trains */ LongDistanceRail = 'LONG_DISTANCE', /** long distance night trains */ NightRail = 'NIGHT_RAIL', /** regional express routes that skip low traffic stops to be faster */ RegionalFastRail = 'REGIONAL_FAST_RAIL', /** regional train */ RegionalRail = 'REGIONAL_RAIL', /** Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle (e.g., cable car in San Francisco). */ CableTram = 'CABLE_CAR', /** Funicular. Any rail system designed for steep inclines. */ Funicular = 'FUNICULAR', /** Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables. */ AerialLift = 'AREAL_LIFT', Other = 'OTHER', } /** * - `NORMAL` - latitude / longitude coordinate or address * - `BIKESHARE` - bike sharing station * - `TRANSIT` - transit stop */ export type VertexType = 'NORMAL' | 'BIKESHARE' | 'TRANSIT'; /** * - `NORMAL` - entry/exit is possible normally * - `NOT_ALLOWED` - entry/exit is not allowed */ export type PickupDropoffType = 'NORMAL' | 'NOT_ALLOWED'; /** Cause of this alert. */ export type AlertCause = | 'UNKNOWN_CAUSE' | 'OTHER_CAUSE' | 'TECHNICAL_PROBLEM' | 'STRIKE' | 'DEMONSTRATION' | 'ACCIDENT' | 'HOLIDAY' | 'WEATHER' | 'MAINTENANCE' | 'CONSTRUCTION' | 'POLICE_ACTIVITY' | 'MEDICAL_EMERGENCY'; /** The effect of this problem on the affected entity. */ export type AlertEffect = | 'NO_SERVICE' | 'REDUCED_SERVICE' | 'SIGNIFICANT_DELAYS' | 'DETOUR' | 'ADDITIONAL_SERVICE' | 'MODIFIED_SERVICE' | 'OTHER_EFFECT' | 'UNKNOWN_EFFECT' | 'STOP_MOVED' | 'NO_EFFECT' | 'ACCESSIBILITY_ISSUE'; /** The severity of the alert. */ export type AlertSeverityLevel = | 'UNKNOWN_SEVERITY' | 'INFO' | 'WARNING' | 'SEVERE'; /** * A time interval. * The interval is considered active at time t if t is greater than or equal to the start time and less than the end time. */ export type TimeRange = { /** * If missing, the interval starts at minus infinity. * If a TimeRange is provided, either start or end must be provided - both fields cannot be empty. */ start?: string; /** * If missing, the interval ends at plus infinity. * If a TimeRange is provided, either start or end must be provided - both fields cannot be empty. */ end?: string; }; /** * An alert, indicating some sort of incident in the public transit network. */ export type Alert = { /** * Time when the alert should be shown to the user. * If missing, the alert will be shown as long as it appears in the feed. * If multiple ranges are given, the alert will be shown during all of them. */ communicationPeriod?: Array; /** * Time when the services are affected by the disruption mentioned in the alert. */ impactPeriod?: Array; cause?: AlertCause; /** * Description of the cause of the alert that allows for agency-specific language; * more specific than the Cause. */ causeDetail?: string; effect?: AlertEffect; /** * Description of the effect of the alert that allows for agency-specific language; * more specific than the Effect. */ effectDetail?: string; /** * The URL which provides additional information about the alert. */ url?: string; /** * Header for the alert. This plain-text string will be highlighted, for example in boldface. */ headerText: string; /** * Description for the alert. * This plain-text string will be formatted as the body of the alert (or shown on an explicit "expand" request by the user). * The information in the description should add to the information of the header. */ descriptionText: string; /** * Text containing the alert's header to be used for text-to-speech implementations. * This field is the text-to-speech version of header_text. * It should contain the same information as headerText but formatted such that it can read as text-to-speech * (for example, abbreviations removed, numbers spelled out, etc.) */ ttsHeaderText?: string; /** * Text containing a description for the alert to be used for text-to-speech implementations. * This field is the text-to-speech version of description_text. * It should contain the same information as description_text but formatted such that it can be read as text-to-speech * (for example, abbreviations removed, numbers spelled out, etc.) */ ttsDescriptionText?: string; /** * Severity of the alert. */ severityLevel?: AlertSeverityLevel; /** * String containing an URL linking to an image. */ imageUrl?: string; /** * IANA media type as to specify the type of image to be displayed. The type must start with "image/" */ imageMediaType?: string; /** * Text describing the appearance of the linked image in the image field * (e.g., in case the image can't be displayed or the user can't see the image for accessibility reasons). * See the HTML spec for alt image text. */ imageAlternativeText?: string; }; export type Place = { /** * name of the transit stop / PoI / address */ name: string; /** * The ID of the stop. This is often something that users don't care about. */ stopId?: string; /** * latitude */ lat: number; /** * longitude */ lon: number; /** * level according to OpenStreetMap */ level: number; /** * arrival time */ arrival?: string; /** * departure time */ departure?: string; /** * scheduled arrival time */ scheduledArrival?: string; /** * scheduled departure time */ scheduledDeparture?: string; /** * scheduled track from the static schedule timetable dataset */ scheduledTrack?: string; /** * The current track/platform information, updated with real-time updates if available. * Can be missing if neither real-time updates nor the schedule timetable contains track information. */ track?: string; /** * description of the location that provides more detailed information */ description?: string; vertexType?: VertexType; /** * Type of pickup. It could be disallowed due to schedule, skipped stops or cancellations. */ pickupType?: PickupDropoffType; /** * Type of dropoff. It could be disallowed due to schedule, skipped stops or cancellations. */ dropoffType?: PickupDropoffType; /** * Whether this stop is cancelled due to the realtime situation. */ cancelled?: boolean; /** * Alerts for this stop. */ alerts?: Array; /** * for `FLEX` transports, the flex location area or location group name */ flex?: string; /** * for `FLEX` transports, the flex location area ID or location group ID */ flexId?: string; /** * Time that on-demand service becomes available */ flexStartPickupDropOffWindow?: string; /** * Time that on-demand service ends */ flexEndPickupDropOffWindow?: string; }; /** * departure or arrival event at a stop */ export type StopTime = { /** * information about the stop place and time */ place: Place; /** * Transport mode for this leg */ mode: Mode; /** * Whether there is real-time data about this leg */ realTime: boolean; /** * For transit legs, the headsign of the bus or train being used. * For non-transit legs, null */ headsign: string; agencyId: string; agencyName: string; agencyUrl: string; routeColor?: string; routeTextColor?: string; tripId: string; routeShortName: string; /** * Type of pickup (for departures) or dropoff (for arrivals), may be disallowed either due to schedule, skipped stops or cancellations */ pickupDropoffType: PickupDropoffType; /** * Whether the departure/arrival is cancelled due to the realtime situation (either because the stop is skipped or because the entire trip is cancelled). */ cancelled: boolean; /** * Whether the entire trip is cancelled due to the realtime situation. */ tripCancelled: boolean; /** * Filename and line number where this trip is from */ source: string; }; export type StoptimesResponse = { /** * list of stop times */ stopTimes: Array; /** * metadata of the requested stop */ place: Place; /** * Use the cursor to get the previous page of results. Insert the cursor into the request and post it to get the previous page. * The previous page is a set of stop times BEFORE the first stop time in the result. */ previousPageCursor: string; /** * Use the cursor to get the next page of results. Insert the cursor into the request and post it to get the next page. * The next page is a set of stop times AFTER the last stop time in this result. */ nextPageCursor: string; }; // export type StoptimesData = { // query: { // /** // * Optional. Default is `false`. // * // * - `arriveBy=true`: the parameters `date` and `time` refer to the arrival time // * - `arriveBy=false`: the parameters `date` and `time` refer to the departure time // */ // arriveBy?: boolean; // /** // * This parameter will be ignored in case `pageCursor` is set. // * // * Optional. Default is // * - `LATER` for `arriveBy=false` // * - `EARLIER` for `arriveBy=true` // * // * The response will contain the next `n` arrivals / departures // * in case `EARLIER` is selected and the previous `n` // * arrivals / departures if `LATER` is selected. // */ // direction?: 'EARLIER' | 'LATER'; // /** // * Optional. Default is `false`. // * // * If set to `true`, only stations that are phyiscally in the radius are considered. // * If set to `false`, additionally to the stations in the radius, equivalences with the same name and children are considered. // */ // exactRadius?: boolean; // /** // * Optional. Default is all transit modes. // * // * Only return arrivals/departures of the given modes. // */ // mode?: Array; // /** // * the number of events // */ // n: number; // /** // * Use the cursor to go to the next "page" of stop times. // * Copy the cursor from the last response and keep the original request as is. // * This will enable you to search for stop times in the next or previous time-window. // */ // pageCursor?: string; // /** // * Optional. Radius in meters. // * // * Default is that only stop times of the parent of the stop itself // * and all stops with the same name (+ their child stops) are returned. // * // * If set, all stops at parent stations and their child stops in the specified radius // * are returned. // */ // radius?: number; // /** // * stop id of the stop to retrieve departures/arrivals for // */ // stopId: string; // /** // * Optional. Defaults to the current time. // */ // time?: string; // /** // * Optional. Include stoptimes where passengers can not alight/board according to schedule. // */ // withScheduledSkippedStops?: boolean; // }; // }; // TODO: Enum export type Direction = | 'DEPART' | 'HARD_LEFT' | 'LEFT' | 'SLIGHTLY_LEFT' | 'CONTINUE' | 'SLIGHTLY_RIGHT' | 'RIGHT' | 'HARD_RIGHT' | 'CIRCLE_CLOCKWISE' | 'CIRCLE_COUNTERCLOCKWISE' | 'STAIRS' | 'ELEVATOR' | 'UTURN_LEFT' | 'UTURN_RIGHT'; export type EncodedPolyline = { /** * The encoded points of the polyline using the Google polyline encoding. */ points: string; /** * The precision of the returned polyline (7 for /v1, 6 for /v2) * Be aware that with precision 7, coordinates with |longitude| > 107.37 are undefined/will overflow. */ precision: number; /** * The number of points in the string */ length: number; }; export type StepInstruction = { relativeDirection: Direction; /** * The distance in meters that this step takes. */ distance: number; /** * level where this segment starts, based on OpenStreetMap data */ fromLevel: number; /** * level where this segment starts, based on OpenStreetMap data */ toLevel: number; /** * OpenStreetMap way index */ osmWay?: number; polyline: EncodedPolyline; /** * The name of the street. */ streetName: string; /** * Not implemented! * When exiting a highway or traffic circle, the exit name/number. */ exit: string; /** * Not implemented! * Indicates whether or not a street changes direction at an intersection. */ stayOn: boolean; /** * Not implemented! * This step is on an open area, such as a plaza or train platform, * and thus the directions should say something like "cross" */ area: boolean; /** * Indicates that a fee must be paid by general traffic to use a road, road bridge or road tunnel. */ toll?: boolean; /** * Experimental. Indicates whether access to this part of the route is restricted. * See: https://wiki.openstreetmap.org/wiki/Conditional_restrictions */ accessRestriction?: string; /** * incline in meters across this path segment */ elevationUp?: number; /** * decline in meters across this path segment */ elevationDown?: number; }; export enum RentalFormFactor { Velo = 'BICYCLE', CargoVelo = 'CARGO_BICYCLE', Car = 'CAR', Moped = 'MOPED', StandingScooter = 'SCOOTER_STANDING', SeatedScooter = 'SCOOTER_SEATED', Other = 'OTHER', } export enum RentalPropulsionType { Creature = 'HUMAN', ElectricAssist = 'ELECTRIC_ASSIST', Electric = 'ELECTRIC', Combustion = 'COMBUSTION', CombustionDiesel = 'COMBUSTION_DIESEL', Hybrid = 'HYBRID', PlugInHybrid = 'PLUG_IN_HYBRID', HydrogenFuelCell = 'HYDROGEN_FUEL_CELL', } export enum RentalReturnConstraint { None = 'NONE', AnyStation = 'ANY_STATION', RoundtripStation = 'ROUNDTRIP_STATION', } /** * Vehicle rental */ export type Rental = { /** * Vehicle share system ID */ systemId: string; /** * Vehicle share system name */ systemName?: string; /** * URL of the vehicle share system */ url?: string; /** * Name of the station */ stationName?: string; /** * Name of the station where the vehicle is picked up (empty for free floating vehicles) */ fromStationName?: string; /** * Name of the station where the vehicle is returned (empty for free floating vehicles) */ toStationName?: string; /** * Rental URI for Android (deep link to the specific station or vehicle) */ rentalUriAndroid?: string; /** * Rental URI for iOS (deep link to the specific station or vehicle) */ rentalUriIOS?: string; /** * Rental URI for web (deep link to the specific station or vehicle) */ rentalUriWeb?: string; formFactor?: RentalFormFactor; propulsionType?: RentalPropulsionType; returnConstraint?: RentalReturnConstraint; }; export type Leg = { /** * Transport mode for this leg */ mode: Mode; from: Place; to: Place; /** * Leg duration in seconds * * If leg is footpath: * The footpath duration is derived from the default footpath * duration using the query parameters `transferTimeFactor` and * `additionalTransferTime` as follows: * `leg.duration = defaultDuration * transferTimeFactor + additionalTransferTime.` * In case the defaultDuration is needed, it can be calculated by * `defaultDuration = (leg.duration - additionalTransferTime) / transferTimeFactor`. * Note that the default values are `transferTimeFactor = 1` and * `additionalTransferTime = 0` in case they are not explicitly * provided in the query. */ duration: number; /** * leg departure time */ startTime: string; /** * leg arrival time */ endTime: string; /** * scheduled leg departure time */ scheduledStartTime: string; /** * scheduled leg arrival time */ scheduledEndTime: string; /** * Whether there is real-time data about this leg */ realTime: boolean; /** * Whether this leg was originally scheduled to run or is an additional service. * Scheduled times will equal realtime times in this case. */ scheduled: boolean; /** * For non-transit legs the distance traveled while traversing this leg in meters. */ distance?: number; /** * For transit legs, if the rider should stay on the vehicle as it changes route names. */ interlineWithPreviousLeg?: boolean; /** * For transit legs, the headsign of the bus or train being used. * For non-transit legs, null */ headsign?: string; routeColor?: string; routeTextColor?: string; routeType?: string | number; agencyName?: string; agencyUrl?: string; agencyId?: string; tripId?: string; routeShortName?: string; /** * Whether this trip is cancelled */ cancelled?: boolean; /** * Filename and line number where this trip is from */ source?: string; /** * For transit legs, intermediate stops between the Place where the leg originates * and the Place where the leg ends. For non-transit legs, null. */ intermediateStops?: Place[]; legGeometry: EncodedPolyline; /** * A series of turn by turn instructions * used for walking, biking and driving. */ steps?: StepInstruction[]; rental?: Rental; /** * Index into `Itinerary.fareTransfers` array * to identify which fare transfer this leg belongs to */ fareTransferIndex?: number; /** * Index into the `Itinerary.fareTransfers[fareTransferIndex].effectiveFareLegProducts` array * to identify which effective fare leg this itinerary leg belongs to */ effectiveFareLegIndex?: number; /** * Alerts for this stop. */ alerts?: Alert[]; /** * If set, this attribute indicates that this trip has been expanded * beyond the feed end date (enabled by config flag `timetable.dataset.extend_calendar`) * by looping active weekdays, e.g. from calendar.txt in GTFS. */ loopedCalendarSince?: string; }; /** * The type of media used for the {@link FareMedia fare payment medium} */ export enum FareMediaType { /** No fare media involved (e.g., cash payment) */ None = 'NONE', /** Physical paper ticket */ PaperTicket = 'PAPER_TICKET', /** Physical transit card with stored value */ TransitCard = 'TRANSIT_CARD', /** cEMV (contactless payment) */ ContactlessPayment = 'CONTACTLESS_EMV', /** Mobile app with virtual transit cards/passes */ MobileAppshit = 'MOBILE_APP', } export type FareMedia = | { /** * Name of the fare media. Required for transit cards and mobile apps. */ fareMediaName: string; /** * The type of fare media. */ fareMediaType: FareMediaType.TransitCard | FareMediaType.MobileAppshit; } | { /** * Name of the fare media. Required for transit cards and mobile apps. */ fareMediaName?: string; /** * The type of fare media. */ fareMediaType: Omit< FareMediaType, FareMediaType.TransitCard | FareMediaType.MobileAppshit >; }; export type RiderCategory = { /** * Rider category name as displayed to the rider. */ riderCategoryName: string; /** * Specifies if this category should be considered the default (i.e. the main category displayed to riders). */ isDefaultFareCategory: boolean; /** * URL to a web page providing detailed information about the rider category and/or its eligibility criteria. */ eligibilityUrl?: string; }; export type FareProduct = { /** * The name of the fare product as displayed to riders. */ name: string; /** * The cost of the fare product. May be negative to represent transfer discounts. May be zero to represent a fare product that is free. */ amount: number; /** * ISO 4217 currency code. The currency of the cost of the fare product. */ currency: string; riderCategory?: RiderCategory; media?: FareMedia; }; export enum FareTransferRule { 'A_AB', 'A_AB_B', 'AB', } /** * The concept is derived from: https://gtfs.org/documentation/schedule/reference/#fare_transfer_rulestxt * * Terminology: * - **Leg**: An itinerary leg as described by the `Leg` type of this API description. * - **Effective Fare Leg**: Itinerary legs can be joined together to form one *effective fare leg*. * - **Fare Transfer**: A fare transfer groups two or more effective fare legs. * - **A** is the first *effective fare leg* of potentially multiple consecutive legs contained in a fare transfer * - **B** is any *effective fare leg* following the first *effective fare leg* in this transfer * - **AB** are all changes between *effective fare legs* contained in this transfer * * The fare transfer rule is used to derive the final set of products of the itinerary legs contained in this transfer: * - A_AB means that any product from the first effective fare leg combined with the product attached to the transfer itself (AB) which can be empty (= free). Note that all subsequent effective fare leg products need to be ignored in this case. * - A_AB_B mean that a product for each effective fare leg needs to be purchased in a addition to the product attached to the transfer itself (AB) which can be empty (= free) * - AB only the transfer product itself has to be purchased. Note that all fare products attached to the contained effective fare legs need to be ignored in this case. * * An itinerary `Leg` references the index of the fare transfer and the index of the effective fare leg in this transfer it belongs to. * */ export type FareTransfer = { rule?: FareTransferRule; transferProducts?: FareProduct[]; /** * Lists all valid fare products for the effective fare legs. * This is an `array>` where the inner array * lists all possible fare products that would cover this effective fare leg. * Each "effective fare leg" can have multiple options for adult/child/weekly/monthly/day/one-way tickets etc. * You can see the outer array as AND (you need one ticket for each effective fare leg (`A_AB_B`), the first effective fare leg (`A_AB`) or no fare leg at all but only the transfer product (`AB`) * and the inner array as OR (you can choose which ticket to buy) * */ effectiveFareLegProducts: FareProduct[][][]; }; export type Itinerary = { /** * journey duration in seconds */ duration: number; /** * journey departure time */ startTime: string; /** * journey arrival time */ endTime: string; /** * The number of transfers this trip has. */ transfers: number; /** * Journey legs */ legs: Leg[]; /** * Fare information */ fareTransfers?: FareTransfer[]; };