diff --git a/docs/openapi.yaml b/docs/openapi.yaml new file mode 100644 index 00000000..79df604c --- /dev/null +++ b/docs/openapi.yaml @@ -0,0 +1,2467 @@ +openapi: 3.0.3 +info: + title: db-vendo-client + description: Schema for db-vendo-client/hafas-client's Friendy Public Transport Format API + contact: + url: https://github.com/public-transport/db-vendo-client + version: 6 +paths: + /stops/{id}: + get: + summary: Finds a stop/station by ID. + description: Uses [`hafasClient.stop()`](https://github.com/public-transport/hafas-client/blob/6/docs/stop.md) to **find a stop/station by ID**. + externalDocs: + description: '`hafasClient.stop()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/stop.md + parameters: + - name: id + in: path + description: stop/station ID + required: true + schema: + type: string + - name: linesOfStops + in: query + description: Parse & expose lines at each stop/station? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: The stop, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/stop.md). + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + /stops/{id}/departures: + get: + summary: Fetches departures at a stop/station. + description: Uses [`hafasClient.departures()`](https://github.com/public-transport/hafas-client/blob/6/docs/departures.md) to **query departures at a stop/station**. + externalDocs: + description: '`hafasClient.departures()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/departures.md + parameters: + - name: id + in: path + description: stop/station ID to show departures for + required: true + schema: + type: string + - name: when + in: query + description: 'Date & time to get departures for. – Default: *now*' + schema: + type: string + format: date-time + - name: direction + in: query + description: Filter departures by direction. + schema: + type: string + - name: duration + in: query + description: Show departures for how many minutes? + schema: + type: integer + default: 10 + - name: results + in: query + description: 'Max. number of departures. – Default: *whatever HAFAS wants' + schema: + type: integer + - name: linesOfStops + in: query + description: Parse & return lines of each stop/station? + schema: + type: boolean + default: false + - name: remarks + in: query + description: Parse & return hints & warnings? + schema: + type: boolean + default: true + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: products + in: query + description: Filter by profile-specific products (e.g. regional transport only). + schema: + $ref: '#/components/schemas/ProfileSpecificProducts' + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An object with an array of departures, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/departures.md). + content: + application/json: + schema: + type: object + properties: + departures: + type: array + items: + $ref: '#/components/schemas/Alternative' + realtimeDataUpdatedAt: + type: integer + required: + - departures + /stops/{id}/arrivals: + get: + summary: Fetches arrivals at a stop/station. + description: Works like `/stops/{id}/departures`, except that it uses [`hafasClient.arrivals()`](https://github.com/public-transport/hafas-client/blob/6/docs/arrivals.md) to **query arrivals at a stop/station**. + externalDocs: + description: '`hafasClient.arrivals()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/arrivals.md + parameters: + - name: id + in: path + description: stop/station ID to show arrivals for + required: true + schema: + type: string + - name: when + in: query + description: 'Date & time to get departures for. – Default: *now*' + schema: + type: string + format: date-time + - name: direction + in: query + description: Filter departures by direction. + schema: + type: string + - name: duration + in: query + description: Show departures for how many minutes? + schema: + type: integer + default: 10 + - name: results + in: query + description: 'Max. number of departures. – Default: *whatever HAFAS wants*' + schema: + type: integer + - name: linesOfStops + in: query + description: Parse & return lines of each stop/station? + schema: + type: boolean + default: false + - name: remarks + in: query + description: Parse & return hints & warnings? + schema: + type: boolean + default: true + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: products + in: query + description: Filter by profile-specific products (e.g. regional transport only). + schema: + $ref: '#/components/schemas/ProfileSpecificProducts' + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An object with an array of arrivals, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/arrivals.md). + content: + application/json: + schema: + type: object + properties: + arrivals: + type: array + items: + $ref: '#/components/schemas/Alternative' + realtimeDataUpdatedAt: + type: integer + required: + - arrivals + /journeys: + get: + summary: Finds journeys from A to B. + description: Uses [`hafasClient.journeys()`](https://github.com/public-transport/hafas-client/blob/6/docs/journeys.md) to **find journeys from A (`from`) to B (`to`)**. + externalDocs: + description: '`hafasClient.journeys()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/journeys.md + parameters: + - name: from + in: query + schema: + type: string + description: '"from" as stop/station ID (e.g. from=8010159 for Halle (Saale) Hbf)' + - name: from.id + in: query + schema: + type: string + description: '"from" as POI (e.g. from.id=991561765&from.latitude=51.48364&from.longitude=11.98084 for Halle+(Saale),+Stadtpark+Halle+(Grünanlagen))' + - name: from.address + in: query + schema: + type: string + description: '"from" as an address (e.g. from.latitude=51.25639&from.longitude=7.46685&from.address=Hansestadt+Breckerfeld,+Hansering+3 for Hansestadt Breckerfeld, Hansering 3)' + - name: from.latitude + in: query + schema: + type: number + - name: from.longitude + in: query + schema: + type: number + - name: to + in: query + schema: + type: string + description: '"to" as stop/station ID' + - name: to.id + in: query + schema: + type: string + description: '"to" as POI' + - name: to.address + in: query + schema: + type: string + description: '"to" as an address' + - name: to.latitude + in: query + schema: + type: number + - name: to.longitude + in: query + schema: + type: number + - name: departure + in: query + description: 'Compute journeys departing at this date/time. Mutually exclusive with `arrival`. – Default: *now*' + schema: + type: string + format: date-time + - name: arrival + in: query + description: 'Compute journeys arriving at this date/time. Mutually exclusive with `departure`. – Default: *now*' + schema: + type: string + format: date-time + - name: earlierThan + in: query + description: Compute journeys "before" an `ealierRef`. + schema: + type: string + - name: laterThan + in: query + description: Compute journeys "after" an `laterRef`. + schema: + type: string + - name: results + in: query + description: Max. number of journeys. + schema: + type: integer + default: 3 + - name: stopovers + in: query + description: Fetch & parse stopovers on the way? + schema: + type: boolean + default: false + - name: transfers + in: query + description: 'Maximum number of transfers. – Default: *let HAFAS decide*' + schema: + type: integer + - name: transferTime + in: query + description: Minimum time in minutes for a single transfer. + schema: + type: integer + default: 0 + - name: accessibility + in: query + description: '`partial` or `complete`. – Default: *not accessible*' + schema: + type: string + - name: bike + in: query + description: Compute only bike-friendly journeys? + schema: + type: boolean + default: false + - name: startWithWalking + in: query + description: Consider walking to nearby stations at the beginning of a journey? + schema: + type: boolean + default: true + - name: walkingSpeed + in: query + description: '`slow`, `normal` or `fast`.' + schema: + type: string + default: normal + enum: + - slow + - normal + - fast + - name: tickets + in: query + description: Return information about available tickets? + schema: + type: boolean + default: false + - name: polylines + in: query + description: Fetch & parse a shape for each journey leg? + schema: + type: boolean + default: false + - name: subStops + in: query + description: Parse & return sub-stops of stations? + schema: + type: boolean + default: true + - name: entrances + in: query + description: Parse & return entrances of stops/stations? + schema: + type: boolean + default: true + - name: remarks + in: query + description: Parse & return hints & warnings? + schema: + type: boolean + default: true + - name: scheduledDays + in: query + description: Parse & return dates each journey is valid on? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: loyaltyCard + in: query + description: 'Type of loyalty card in use. – Default: *none*' + schema: + type: string + enum: + - bahncard-1st-25 + - bahncard-2nd-25 + - bahncard-1st-50 + - bahncard-2nd-50 + - vorteilscard + - halbtaxabo-railplus + - halbtaxabo + - voordeelurenabo-railplus + - voordeelurenabo + - shcard + - generalabonnement + - name: firstClass + in: query + description: Search for first-class options? + schema: + type: boolean + default: 'false' + - name: age + in: query + description: 'Age of traveller – Default: *adult*' + schema: + type: integer + - name: products + in: query + description: Filter by profile-specific products (e.g. regional transport only). + schema: + $ref: '#/components/schemas/ProfileSpecificProducts' + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An object with an array of journeys, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/journeys.md). + content: + application/json: + schema: + type: object + properties: + journeys: + type: array + items: + $ref: '#/components/schemas/Journey' + realtimeDataUpdatedAt: + type: integer + earlierRef: + type: string + laterRef: + type: string + required: + - journeys + /trips/{id}: + get: + summary: Fetches a trip by ID. + description: Uses [`hafasClient.trip()`](https://github.com/public-transport/hafas-client/blob/6/docs/trip.md) to **fetch a trip by ID**. + externalDocs: + description: '`hafasClient.trip()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/trip.md + parameters: + - name: id + in: path + description: trip ID + required: true + schema: + type: string + - name: stopovers + in: query + description: Fetch & parse stopovers on the way? + schema: + type: boolean + default: true + - name: remarks + in: query + description: Parse & return hints & warnings? + schema: + type: boolean + default: true + - name: polyline + in: query + description: Fetch & parse the geographic shape of the trip? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An object with the trip, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/trip.md). + content: + application/json: + schema: + type: object + properties: + trip: + $ref: '#/components/schemas/Trip' + realtimeDataUpdatedAt: + type: integer + required: + - trip + /locations/nearby: + get: + summary: Finds stops/stations & POIs close to a geolocation. + description: Uses [`hafasClient.nearby()`](https://github.com/public-transport/hafas-client/blob/6/docs/nearby.md) to **find stops/stations & POIs close to the given geolocation**. + externalDocs: + description: '`hafasClient.nearby()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/nearby.md + parameters: + - name: location + in: query + schema: + $ref: '#/components/schemas/Location' + - name: results + in: query + description: maximum number of results + schema: + type: integer + default: 8 + - name: distance + in: query + description: 'maximum walking distance in meters – Default: –' + schema: + type: integer + - name: stops + in: query + description: Return stops/stations? + schema: + type: boolean + default: true + - name: poi + in: query + description: Return points of interest? + schema: + type: boolean + default: false + - name: linesOfStops + in: query + description: Parse & expose lines at each stop/station? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An array of locations, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/nearby.md). + content: + application/json: + schema: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + /locations: + get: + summary: Finds stops/stations, POIs and addresses matching a query. + description: Uses [`hafasClient.locations()`](https://github.com/public-transport/hafas-client/blob/6/docs/locations.md) to **find stops/stations, POIs and addresses matching `query`**. + externalDocs: + description: '`hafasClient.locations()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/locations.md + parameters: + - name: query + in: query + description: The term to search for. + required: true + schema: + type: string + - name: fuzzy + in: query + description: Find more than exact matches? + schema: + type: boolean + default: true + - name: results + in: query + description: How many stations shall be shown? + schema: + type: integer + default: 10 + - name: stops + in: query + description: Show stops/stations? + schema: + type: boolean + default: true + - name: addresses + in: query + description: Show addresses? + schema: + type: boolean + default: true + - name: poi + in: query + description: Show points of interest? + schema: + type: boolean + default: true + - name: linesOfStops + in: query + description: Parse & return lines of each stop/station? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An array of locations, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/locations.md). + content: + application/json: + schema: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + /journeys/{ref}: + get: + summary: Fetches up-to-date realtime data for a journey computed before. + description: |- + Uses [`hafasClient.refreshJourney()`](https://github.com/public-transport/hafas-client/blob/6/docs/refresh-journey.md) to **"refresh" a journey, using its `refreshToken`**. + + The journey will be the same (equal `from`, `to`, `via`, date/time & vehicles used), but you can get up-to-date realtime data, like delays & cancellations. + externalDocs: + description: '`hafasClient.refreshJourney()` documentation' + url: https://github.com/public-transport/hafas-client/blob/6/docs/refresh-journey.md + parameters: + - name: ref + in: path + description: The journey's `refreshToken`. + required: true + schema: + type: string + - name: stopovers + in: query + description: Fetch & parse stopovers on the way? + schema: + type: boolean + default: false + - name: tickets + in: query + description: Return information about available tickets? + schema: + type: boolean + default: false + - name: polylines + in: query + description: Fetch & parse a shape for each journey leg? + schema: + type: boolean + default: false + - name: subStops + in: query + description: Parse & return sub-stops of stations? + schema: + type: boolean + default: true + - name: entrances + in: query + description: Parse & return entrances of stops/stations? + schema: + type: boolean + default: true + - name: remarks + in: query + description: Parse & return hints & warnings? + schema: + type: boolean + default: true + - name: scheduledDays + in: query + description: Parse & return dates the journey is valid on? + schema: + type: boolean + default: false + - name: language + in: query + description: Language of the results. + schema: + type: string + default: en + - name: pretty + in: query + description: Pretty-print JSON responses? + schema: + type: boolean + responses: + 2XX: + description: An object with the up-to-date journey, in the [`hafas-client` format](https://github.com/public-transport/hafas-client/blob/6/docs/refresh-journey.md). + content: + application/json: + schema: + type: object + properties: + journey: + $ref: '#/components/schemas/Journey' + realtimeDataUpdatedAt: + type: integer + required: + - journey +components: + schemas: + ProductType: + description: |- + A ProductType relates to how a means of transport "works" in local context. + Example: Even though S-Bahn and U-Bahn in Berlin are both trains, they have different operators, service patterns, + stations and look different. Therefore, they are two distinct products subway and suburban. + type: object + properties: + id: + type: string + mode: + enum: + - aircraft + - bicycle + - bus + - car + - gondola + - taxi + - train + - walking + - watercraft + type: string + name: + type: string + short: + type: string + bitmasks: + type: array + items: + type: number + default: + type: boolean + Profile: + description: |- + A profile is a specific customisation for each endpoint. + It parses data from the API differently, add additional information, or enable non-default methods. + type: object + properties: + locale: + type: string + timezone: + type: string + endpoint: + type: string + products: + type: array + items: + $ref: '#/components/schemas/ProductType' + trip: + type: boolean + radar: + type: boolean + refreshJourney: + type: boolean + journeysFromTrip: + type: boolean + reachableFrom: + type: boolean + journeysWalkingSpeed: + type: boolean + tripsByName: + type: boolean + remarks: + type: boolean + remarksGetPolyline: + type: boolean + lines: + type: boolean + Location: + description: A location object is used by other items to indicate their locations. + type: object + properties: + type: + type: string + enum: + - location + id: + type: string + name: + type: string + poi: + type: boolean + address: + type: string + longitude: + type: number + latitude: + type: number + altitude: + type: number + distance: + type: number + Products: + description: Each public transportation network exposes its products as boolean properties. See {@link ProductType} + type: object + additionalProperties: + type: boolean + Facilities: + type: object + additionalProperties: + type: string + ReisezentrumOpeningHours: + type: object + properties: + Mo: + type: string + Di: + type: string + Mi: + type: string + Do: + type: string + Fr: + type: string + Sa: + type: string + So: + type: string + Station: + description: |- + A station is a larger building or area that can be identified by a name. + It is usually represented by a single node on a public transport map. + Whereas a stop usually specifies a location, a station often is a broader area + that may span across multiple levels or buildings. + type: object + properties: + type: + type: string + enum: + - station + id: + type: string + name: + type: string + station: + $ref: '#/components/schemas/Station' + location: + $ref: '#/components/schemas/Location' + products: + $ref: '#/components/schemas/Products' + lines: + type: array + items: + $ref: '#/components/schemas/Line' + isMeta: + type: boolean + regions: + description: region ids + type: array + items: + type: string + facilities: + $ref: '#/components/schemas/Facilities' + reisezentrumOpeningHours: + $ref: '#/components/schemas/ReisezentrumOpeningHours' + stops: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + entrances: + type: array + items: + $ref: '#/components/schemas/Location' + transitAuthority: + type: string + distance: + type: number + Ids: + description: Ids of a Stop, i.e. dhid as 'DELFI Haltestellen ID' + type: object + additionalProperties: + type: string + Stop: + description: |- + A stop is a single small point or structure at which vehicles stop. + A stop always belongs to a station. It may for example be a sign, a basic shelter or a railway platform. + type: object + properties: + type: + type: string + enum: + - stop + id: + type: string + name: + type: string + location: + $ref: '#/components/schemas/Location' + station: + $ref: '#/components/schemas/Station' + products: + $ref: '#/components/schemas/Products' + lines: + type: array + items: + $ref: '#/components/schemas/Line' + isMeta: + type: boolean + reisezentrumOpeningHours: + $ref: '#/components/schemas/ReisezentrumOpeningHours' + ids: + $ref: '#/components/schemas/Ids' + loadFactor: + type: string + entrances: + type: array + items: + $ref: '#/components/schemas/Location' + transitAuthority: + type: string + distance: + type: number + Region: + description: A region is a group of stations, for example a metropolitan area or a geographical or cultural region. + type: object + properties: + type: + type: string + enum: + - region + id: + type: string + name: + type: string + stations: + description: station ids + type: array + items: + type: string + Line: + type: object + properties: + type: + type: string + enum: + - line + id: + type: string + name: + type: string + adminCode: + type: string + fahrtNr: + type: string + additionalName: + type: string + product: + type: string + public: + type: boolean + mode: + enum: + - aircraft + - bicycle + - bus + - car + - gondola + - taxi + - train + - walking + - watercraft + type: string + routes: + description: routes ids + type: array + items: + type: string + operator: + $ref: '#/components/schemas/Operator' + express: + type: boolean + metro: + type: boolean + night: + type: boolean + nr: + type: number + symbol: + type: string + directions: + type: array + items: + type: string + productName: + type: string + RealtimeDataUpdatedAt: + type: object + properties: + realtimeDataUpdatedAt: + type: number + Route: + description: A route represents a single set of stations, of a single line. + type: object + properties: + type: + type: string + enum: + - route + id: + type: string + line: + type: string + mode: + enum: + - aircraft + - bicycle + - bus + - car + - gondola + - taxi + - train + - walking + - watercraft + type: string + stops: + description: stop ids + type: array + items: + type: string + Cycle: + type: object + properties: + min: + type: number + max: + type: number + nr: + type: number + ArrivalDeparture: + type: object + properties: + arrival: + type: number + departure: + type: number + Schedule: + description: |- + There are many ways to format schedules of public transport routes. + This one tries to balance the amount of data and consumability. + It is specifically geared towards urban public transport, with frequent trains and homogenous travels. + type: object + properties: + type: + type: string + enum: + - schedule + id: + type: string + route: + type: string + mode: + enum: + - aircraft + - bicycle + - bus + - car + - gondola + - taxi + - train + - walking + - watercraft + type: string + sequence: + type: array + items: + $ref: '#/components/schemas/ArrivalDeparture' + starts: + description: array of Unix timestamps + type: array + items: + type: string + Operator: + type: object + properties: + type: + type: string + enum: + - operator + id: + type: string + name: + type: string + Hint: + type: object + properties: + type: + enum: + - foreign-id + - hint + - local-fare-zone + - status + - stop-dhid + - stop-website + - transit-authority + type: string + code: + type: string + summary: + type: string + text: + type: string + tripId: + type: string + Status: + type: object + properties: + type: + enum: + - foreign-id + - hint + - local-fare-zone + - status + - stop-dhid + - stop-website + - transit-authority + type: string + code: + type: string + summary: + type: string + text: + type: string + tripId: + type: string + IcoCrd: + type: object + properties: + x: + type: number + 'y': + type: number + type: + type: string + Edge: + type: object + properties: + fromLocation: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + toLocation: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + icon: + type: object + properties: {} + additionalProperties: true + dir: + type: number + icoCrd: + $ref: '#/components/schemas/IcoCrd' + Event: + type: object + properties: + fromLocation: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + toLocation: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + start: + type: string + end: + type: string + sections: + type: array + items: + type: string + Warning: + type: object + properties: + type: + enum: + - status + - warning + type: string + id: + type: string + icon: + type: object + properties: {} + additionalProperties: true + summary: + type: string + text: + type: string + category: + type: string + priority: + type: number + products: + $ref: '#/components/schemas/Products' + edges: + type: array + items: + $ref: '#/components/schemas/Edge' + events: + type: array + items: + $ref: '#/components/schemas/Event' + validFrom: + type: string + validUntil: + type: string + modified: + type: string + company: + type: string + categories: + type: array + items: + type: number + affectedLines: + type: array + items: + $ref: '#/components/schemas/Line' + fromStops: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + toStops: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + Geometry: + type: object + properties: + type: + type: string + enum: + - Point + coordinates: + type: array + items: + type: number + Feature: + type: object + properties: + type: + type: string + enum: + - Feature + properties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + geometry: + $ref: '#/components/schemas/Geometry' + FeatureCollection: + type: object + properties: + type: + type: string + enum: + - FeatureCollection + features: + type: array + items: + $ref: '#/components/schemas/Feature' + PrognosisType: + enum: + - calculated + - prognosed + type: string + StopOver: + description: A stopover represents a vehicle stopping at a stop/station at a specific time. + type: object + properties: + stop: + anyOf: + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + departure: + description: null, if last stopOver of trip + type: string + departureDelay: + type: number + prognosedDeparture: + type: string + plannedDeparture: + type: string + departurePlatform: + type: string + prognosedDeparturePlatform: + type: string + plannedDeparturePlatform: + type: string + arrival: + description: null, if first stopOver of trip + type: string + arrivalDelay: + type: number + prognosedArrival: + type: string + plannedArrival: + type: string + arrivalPlatform: + type: string + prognosedArrivalPlatform: + type: string + plannedArrivalPlatform: + type: string + remarks: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Hint' + - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/Warning' + passBy: + type: boolean + cancelled: + type: boolean + departurePrognosisType: + $ref: '#/components/schemas/PrognosisType' + arrivalPrognosisType: + $ref: '#/components/schemas/PrognosisType' + additional: + type: boolean + Trip: + description: Trip – a vehicle stopping at a set of stops at specific times + type: object + properties: + id: + type: string + origin: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + destination: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + departure: + type: string + plannedDeparture: + type: string + prognosedArrival: + type: string + departureDelay: + type: number + departurePlatform: + type: string + prognosedDeparturePlatform: + type: string + plannedDeparturePlatform: + type: string + arrival: + type: string + plannedArrival: + type: string + prognosedDeparture: + type: string + arrivalDelay: + type: number + arrivalPlatform: + type: string + prognosedArrivalPlatform: + type: string + plannedArrivalPlatform: + type: string + stopovers: + type: array + items: + $ref: '#/components/schemas/StopOver' + schedule: + type: number + price: + $ref: '#/components/schemas/Price' + operator: + type: number + direction: + type: string + line: + $ref: '#/components/schemas/Line' + cancelled: + type: boolean + walking: + type: boolean + loadFactor: + type: string + distance: + type: number + public: + type: boolean + transfer: + type: boolean + cycle: + $ref: '#/components/schemas/Cycle' + alternatives: + type: array + items: + $ref: '#/components/schemas/Alternative' + polyline: + $ref: '#/components/schemas/FeatureCollection' + remarks: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Hint' + - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/Warning' + currentLocation: + $ref: '#/components/schemas/Location' + departurePrognosisType: + $ref: '#/components/schemas/PrognosisType' + arrivalPrognosisType: + $ref: '#/components/schemas/PrognosisType' + checkin: + type: boolean + scheduledDays: + $ref: '#/components/schemas/ScheduledDays' + TripWithRealtimeData: + type: object + properties: + trip: + $ref: '#/components/schemas/Trip' + realtimeDataUpdatedAt: + type: number + TripsWithRealtimeData: + type: object + properties: + trips: + type: array + items: + $ref: '#/components/schemas/Trip' + realtimeDataUpdatedAt: + type: number + WarningsWithRealtimeData: + type: object + properties: + remarks: + type: array + items: + $ref: '#/components/schemas/Warning' + realtimeDataUpdatedAt: + type: number + LinesWithRealtimeData: + type: object + properties: + lines: + type: array + items: + $ref: '#/components/schemas/Line' + realtimeDataUpdatedAt: + type: number + Price: + type: object + properties: + amount: + type: number + currency: + type: string + hint: + type: string + Alternative: + type: object + properties: + tripId: + type: string + direction: + type: string + location: + $ref: '#/components/schemas/Location' + line: + $ref: '#/components/schemas/Line' + stop: + anyOf: + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + when: + type: string + plannedWhen: + type: string + prognosedWhen: + type: string + delay: + type: number + platform: + type: string + plannedPlatform: + type: string + prognosedPlatform: + type: string + remarks: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Hint' + - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/Warning' + cancelled: + type: boolean + loadFactor: + type: string + provenance: + type: string + previousStopovers: + type: array + items: + $ref: '#/components/schemas/StopOver' + nextStopovers: + type: array + items: + $ref: '#/components/schemas/StopOver' + frames: + type: array + items: + $ref: '#/components/schemas/Frame' + polyline: + $ref: '#/components/schemas/FeatureCollection' + currentTripPosition: + $ref: '#/components/schemas/Location' + origin: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + destination: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + prognosisType: + $ref: '#/components/schemas/PrognosisType' + Departures: + type: object + properties: + departures: + type: array + items: + $ref: '#/components/schemas/Alternative' + realtimeDataUpdatedAt: + type: number + Arrivals: + type: object + properties: + arrivals: + type: array + items: + $ref: '#/components/schemas/Alternative' + realtimeDataUpdatedAt: + type: number + Leg: + description: Leg of journey + type: object + properties: + tripId: + type: string + origin: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + destination: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + departure: + type: string + plannedDeparture: + type: string + prognosedArrival: + type: string + departureDelay: + type: number + departurePlatform: + type: string + prognosedDeparturePlatform: + type: string + plannedDeparturePlatform: + type: string + arrival: + type: string + plannedArrival: + type: string + prognosedDeparture: + type: string + arrivalDelay: + type: number + arrivalPlatform: + type: string + prognosedArrivalPlatform: + type: string + plannedArrivalPlatform: + type: string + stopovers: + type: array + items: + $ref: '#/components/schemas/StopOver' + schedule: + type: number + price: + $ref: '#/components/schemas/Price' + operator: + type: number + direction: + type: string + line: + $ref: '#/components/schemas/Line' + reachable: + type: boolean + cancelled: + type: boolean + walking: + type: boolean + loadFactor: + type: string + distance: + type: number + public: + type: boolean + transfer: + type: boolean + cycle: + $ref: '#/components/schemas/Cycle' + alternatives: + type: array + items: + $ref: '#/components/schemas/Alternative' + polyline: + $ref: '#/components/schemas/FeatureCollection' + remarks: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Hint' + - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/Warning' + currentLocation: + $ref: '#/components/schemas/Location' + departurePrognosisType: + $ref: '#/components/schemas/PrognosisType' + arrivalPrognosisType: + $ref: '#/components/schemas/PrognosisType' + checkin: + type: boolean + ScheduledDays: + type: object + additionalProperties: + type: boolean + Journey: + description: |- + A journey is a computed set of directions to get from A to B at a specific time. + It would typically be the result of a route planning algorithm. + type: object + properties: + type: + type: string + enum: + - journey + legs: + type: array + items: + $ref: '#/components/schemas/Leg' + refreshToken: + type: string + remarks: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Hint' + - $ref: '#/components/schemas/Status' + - $ref: '#/components/schemas/Warning' + price: + $ref: '#/components/schemas/Price' + cycle: + $ref: '#/components/schemas/Cycle' + scheduledDays: + $ref: '#/components/schemas/ScheduledDays' + Journeys: + type: object + properties: + earlierRef: + type: string + laterRef: + type: string + journeys: + type: array + items: + $ref: '#/components/schemas/Journey' + realtimeDataUpdatedAt: + type: number + JourneyWithRealtimeData: + type: object + properties: + journey: + $ref: '#/components/schemas/Journey' + realtimeDataUpdatedAt: + type: number + Duration: + type: object + properties: + duration: + type: number + stations: + type: array + items: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Station' + - $ref: '#/components/schemas/Stop' + DurationsWithRealtimeData: + type: object + properties: + reachable: + type: array + items: + $ref: '#/components/schemas/Duration' + realtimeDataUpdatedAt: + type: number + Frame: + type: object + properties: + origin: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Stop' + destination: + anyOf: + - $ref: '#/components/schemas/Location' + - $ref: '#/components/schemas/Stop' + t: + type: number + Movement: + type: object + properties: + direction: + type: string + tripId: + type: string + line: + $ref: '#/components/schemas/Line' + location: + $ref: '#/components/schemas/Location' + nextStopovers: + type: array + items: + $ref: '#/components/schemas/StopOver' + frames: + type: array + items: + $ref: '#/components/schemas/Frame' + polyline: + $ref: '#/components/schemas/FeatureCollection' + Radar: + type: object + properties: + movements: + type: array + items: + $ref: '#/components/schemas/Movement' + realtimeDataUpdatedAt: + type: number + ServerInfo: + type: object + properties: + hciVersion: + type: string + timetableStart: + type: string + timetableEnd: + type: string + serverTime: + type: string + realtimeDataUpdatedAt: + type: number + JourneysOptionsCommon: + type: object + properties: + departure: + description: departure date, undefined corresponds to Date.Now + default: undefined + type: string + format: date-time + arrival: + description: arrival date, departure and arrival are mutually exclusive. + default: undefined + type: string + format: date-time + earlierThan: + description: earlierThan, use {@link Journeys#earlierRef}, earlierThan and departure/arrival are mutually exclusive. + default: undefined + type: string + laterThan: + description: laterThan, use {@link Journeys#laterRef}, laterThan and departure/arrival are mutually exclusive. + default: undefined + type: string + results: + description: how many search results? + default: 3 + type: number + via: + description: let journeys pass this station + default: undefined + type: string + stopovers: + description: return stations on the way? + default: false + type: boolean + transfers: + description: 'Maximum nr of transfers. Default: Let HAFAS decide.' + default: 10 + type: number + transferTime: + description: minimum time for a single transfer in minutes + default: 10 + type: number + accessibility: + description: '''none'', ''partial'' or ''complete''' + default: none + type: string + bike: + description: only bike-friendly journeys + default: false + type: boolean + products: + $ref: '#/components/schemas/Products' + tickets: + description: return tickets? only available with some profiles + default: false + type: boolean + polylines: + description: return a shape for each leg? + default: false + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: false + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + remarks: + description: parse & expose hints & warnings? + default: true + type: boolean + walkingSpeed: + description: '''slow'', ''normal'', ''fast''' + default: slow + type: string + startWithWalking: + description: start with walking + default: false + type: boolean + language: + description: language to get results in + default: en + type: string + scheduledDays: + description: parse which days each journey is valid on + default: false + type: boolean + when: + type: string + format: date-time + LoyaltyCard: + type: object + properties: + type: + type: string + discount: + type: number + class: + type: number + AgeGroup: + enum: + - B + - E + - K + - S + - 'Y' + type: string + RoutingMode: + enum: + - FULL + - HYBRID + - INFOS + - 'OFF' + - REALTIME + - SERVER_DEFAULT + type: string + JourneysOptionsDbProfile: + description: JourneysOptions specific to Db Profile + type: object + properties: + firstClass: + description: firstClass + default: false + type: boolean + ageGroup: + $ref: '#/components/schemas/AgeGroup' + description: ageGroup + default: none + age: + description: age + default: none + type: number + loyaltyCard: + $ref: '#/components/schemas/LoyaltyCard' + description: LoyaltyCard + default: none + routingMode: + $ref: '#/components/schemas/RoutingMode' + description: RoutingMode + default: none + JourneysOptions: + allOf: + - $ref: '#/components/schemas/JourneysOptionsCommon' + - $ref: '#/components/schemas/JourneysOptionsDbProfile' + JourneysFromTripOptions: + type: object + properties: + stopovers: + description: return stations on the way? + default: false + type: boolean + transferTime: + description: minimum time for a single transfer in minutes + default: 0 + type: number + accessibility: + description: '''none'', ''partial'' or ''complete''' + default: '''none''' + type: string + tickets: + description: return tickets? + default: false + type: boolean + polylines: + description: return leg shapes? + default: false + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + remarks: + description: parse & expose hints & warnings? + default: true + type: boolean + products: + $ref: '#/components/schemas/Products' + description: products + default: undefined + LocationsOptions: + type: object + properties: + fuzzy: + description: find only exact matches? + default: true + type: boolean + results: + description: how many search results? + default: 10 + type: number + stops: + description: return stops/stations? + default: true + type: boolean + addresses: + description: return addresses + default: false + type: boolean + poi: + description: points of interest + default: true + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: false + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + linesOfStops: + description: parse & expose lines at each stop/station? + default: false + type: boolean + language: + description: Language of the results + default: en + type: string + TripOptions: + type: object + properties: + stopovers: + description: return stations on the way? + default: true + type: boolean + polyline: + description: return a shape for the trip? + default: false + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + remarks: + description: parse & expose hints & warnings? + default: true + type: boolean + scheduledDays: + description: parse which days each journey is valid on + default: false + type: boolean + language: + description: Language of the results + default: en + type: string + StopOptions: + type: object + properties: + linesOfStops: + description: parse & expose lines at the stop/station? + default: false + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + remarks: + description: parse & expose hints & warnings? + default: true + type: boolean + language: + description: Language of the results + default: en + type: string + DeparturesArrivalsOptions: + type: object + properties: + when: + description: departure date, undefined corresponds to Date.Now + default: undefined + type: string + format: date-time + direction: + description: only show departures heading to this station + default: undefined + type: string + line: + description: filter by line ID + default: undefined + type: string + duration: + description: show departures for the next n minutes + default: 120 + type: number + results: + description: max. number of results; `null` means "whatever HAFAS wants" + default: 10 + type: number + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + linesOfStops: + description: parse & expose lines at the stop/station? + default: false + type: boolean + remarks: + description: parse & expose hints & warnings? + default: false + type: boolean + stopovers: + description: fetch & parse previous/next stopovers? + default: false + type: boolean + includeRelatedStations: + description: departures at related stations + default: false + type: boolean + products: + $ref: '#/components/schemas/Products' + description: products + default: undefined + language: + description: language + default: en + type: string + RefreshJourneyOptions: + type: object + properties: + stopovers: + description: return stations on the way? + default: false + type: boolean + polylines: + description: return a shape for each leg? + default: false + type: boolean + tickets: + description: return tickets? only available with some profiles + default: false + type: boolean + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + remarks: + description: parse & expose hints & warnings? + default: true + type: boolean + scheduledDays: + description: parse & expose dates the journey is valid on? + default: false + type: boolean + language: + description: language + default: en + type: string + NearByOptions: + type: object + properties: + results: + description: maximum number of results + default: 8 + type: number + distance: + description: maximum walking distance in meters + default: undefined + type: number + poi: + description: return points of interest? + default: false + type: boolean + stops: + description: return stops/stations? + default: true + type: boolean + products: + $ref: '#/components/schemas/Products' + description: products + default: undefined + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + linesOfStops: + description: parse & expose lines at each stop/station? + default: false + type: boolean + language: + description: language + default: en + type: string + ReachableFromOptions: + type: object + properties: + when: + description: when + default: undefined + type: string + format: date-time + maxTransfers: + description: maximum of transfers + default: 5 + type: number + maxDuration: + description: maximum travel duration in minutes, pass `null` for infinite + default: 20 + type: number + products: + $ref: '#/components/schemas/Products' + description: products + default: undefined + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + polylines: + description: return leg shapes? + default: false + type: boolean + BoundingBox: + type: object + properties: + north: + type: number + west: + type: number + south: + type: number + east: + type: number + RadarOptions: + type: object + properties: + results: + description: maximum number of vehicles + default: 256 + type: number + frames: + description: nr of frames to compute + default: 3 + type: number + products: + $ref: '#/components/schemas/Products' + description: optionally an object of booleans + default: null + duration: + description: compute frames for the next n seconds + default: 20 + type: number + subStops: + description: parse & expose sub-stops of stations? + default: true + type: boolean + entrances: + description: parse & expose entrances of stops/stations? + default: true + type: boolean + polylines: + description: return a shape for the trip? + default: false + type: boolean + when: + description: when + default: undefined + type: string + format: date-time + Filter: + type: object + properties: + type: + type: string + mode: + type: string + value: + type: string + TripsByNameOptions: + type: object + properties: + when: + description: departure date, undefined corresponds to Date.Now + default: undefined + type: string + format: date-time + fromWhen: + type: string + format: date-time + untilWhen: + type: string + format: date-time + onlyCurrentlyRunning: + type: boolean + products: + $ref: '#/components/schemas/Products' + currentlyStoppingAt: + type: string + lineName: + type: string + operatorNames: + type: array + items: + type: string + additionalFilters: + type: array + items: + $ref: '#/components/schemas/Filter' + RemarksOptions: + type: object + properties: + from: + anyOf: + - type: string + format: date-time + - type: number + to: + anyOf: + - type: string + format: date-time + - type: number + results: + description: maximum number of remarks + default: 100 + type: number + products: + $ref: '#/components/schemas/Products' + polylines: + description: return leg shapes? (not supported by all endpoints) + default: false + type: boolean + language: + description: Language of the results + default: en + type: string + LinesOptions: + type: object + properties: + language: + description: Language of the results + default: en + type: string + ServerOptions: + type: object + properties: + versionInfo: + description: versionInfo + default: true + type: boolean + language: + description: Language of the results + default: en + type: string + HafasClient: + type: object + properties: + journeys: + description: Retrieves journeys + type: object + refreshJourney: + description: refreshes a Journey + type: object + trip: + description: Refetch information about a trip + type: object + departures: + description: Retrieves departures + type: object + arrivals: + description: Retrieves arrivals + type: object + journeysFromTrip: + description: Retrieves journeys from trip id to station + type: object + locations: + description: Retrieves locations or stops + type: object + stop: + description: Retrieves information about a stop + type: object + nearby: + description: Retrieves nearby stops from location + type: object + reachableFrom: + description: Retrieves stations reachable within a certain time from a location + type: object + radar: + description: Retrieves all vehicles currently in an area. + type: object + tripsByName: + description: Retrieves trips by name. + type: object + remarks: + description: Fetches all remarks known to the HAFAS endpoint + type: object + lines: + description: Fetches all lines known to the HAFAS endpoint + type: object + serverInfo: + description: Fetches meta information from the HAFAS endpoint + type: object + ProfileSpecificProducts: + type: object + properties: + nationalExpress: + description: Include InterCityExpress (ICE)? + type: boolean + default: true + national: + description: Include InterCity & EuroCity (IC/EC)? + type: boolean + default: true + regionalExpress: + description: Include InterRegio, FlixTrain, Westbahn etc.? + type: boolean + default: true + regional: + description: Include Regio (RB)? + type: boolean + default: true + suburban: + description: Include S-Bahn (S)? + type: boolean + default: true + bus: + description: Include Bus (B)? + type: boolean + default: true + ferry: + description: Include Ferry (F)? + type: boolean + default: true + subway: + description: Include U-Bahn (U)? + type: boolean + default: true + tram: + description: Include Tram (T)? + type: boolean + default: true + taxi: + description: Include Group Taxi (Taxi)? + type: boolean + default: true +externalDocs: + description: human-readable docs + url: http://example.org diff --git a/readme.md b/readme.md index e241cc92..4ba9c8ae 100644 --- a/readme.md +++ b/readme.md @@ -66,6 +66,8 @@ docker run \ ghcr.io/public-transport/db-vendo-client ``` +You may want to generate a client for your programming language for this REST API using the [OpenAPI schema](openapi.yaml) ([open in Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/public-transport/db-vendo-client/refs/heads/master/docs/openapi.yaml)). Note that some profile-specific details like tickets are missing from this API definition. + There are [community-maintained TypeScript typings available as `@types/hafas-client`](https://www.npmjs.com/package/@types/hafas-client). ## Related Projects