ojp-sdk
    Preparing search index...

    Class TripRequest

    TripRequest (TR) class

    Instances are created via static methods below. Direct construction is intentionally disabled.

    • initWithPlaceRefsOrCoords - use place refs or literal coordinates (lat, lng) for origin, destinatio
    • initWithPlaces - use Place OJP XSD schema objects

    Hierarchy

    Index

    Initialization

    • Initializes a TripRequest object with either place references or coordinates.

      Parameters

      • originPlaceRefS: string

        The origin place reference string - place reference or coordinate literals (lat, lon WGS84)

      • destinationPlaceRefS: string

        The destination place reference string - place reference or coordinate literals (lat, lon WGS84)

      Returns TripRequest

    • Creates a new instance of the request class with a mock request XML string

      This method is used for testing purposes to simulate API requests with predefined XML payloads. When this mock is set, the request will use the provided XML instead of building a new one.

      Type Parameters

      • T_This extends { Default(): any }

      Parameters

      • this: T_This
      • mockText: string

        The XML string to use as the mock request

      Returns ReturnType<T_This["Default"]>

      A new instance of the request class with the mock set

      const mockRequest = LocationInformationRequest.initWithRequestMock('<OJP>...</OJP>');
      
    • Creates a new instance of the request class with a mock response XML string

      This method is used for testing purposes to simulate API responses with predefined XML payloads. When this mock is set, the request will use the provided XML response instead of making actual API calls.

      Type Parameters

      • T_This extends { Default(): any }

      Parameters

      • this: T_This
      • mockText: string

        The XML string to use as the mock response

      Returns ReturnType<T_This["Default"]>

      A new instance of the request class with the mock set

      const mockRequest = LocationInformationRequest.initWithResponseMock('<OJP>...</OJP>');
      

    Request Payload Modification

    • Updates arrival at destination datetime in the request payload

      Parameters

      • newDatetime: Date = ...

      Returns void

    • Updates departure from origin datetime in the request payload

      Parameters

      • newDatetime: Date = ...

      Returns void

    • Parameters

      • minDuration: number | null
      • maxDuration: number | null
      • minDistance: number | null
      • maxDistance: number | null

      Returns void

    • Parameters

      • maxDurationMinutes: number | undefined = undefined
      • endpointType: EndpointType = 'both'

      Returns void

    • Parameters

      • minDuration: number | null
      • maxDuration: number | null
      • minDistance: number | null
      • maxDistance: number | null

      Returns void

    • Parameters

      • motFilter:
            | (
                | "other"
                | "unknown"
                | "air"
                | "bus"
                | "coach"
                | "trolleyBus"
                | "metro"
                | "rail"
                | "tram"
                | "water"
                | "ferry"
                | "cableway"
                | "funicular"
                | "lift"
                | "telecabin"
            )[]
            | null = null

      Returns void

    • Parameters

      • railSubmodes:
            | "international"
            | "highSpeedRail"
            | "interregionalRail"
            | "railShuttle"
            | "local"
            | "vehicleTunnelTransportRailService"
            | (
                | "international"
                | "highSpeedRail"
                | "interregionalRail"
                | "railShuttle"
                | "local"
                | "vehicleTunnelTransportRailService"
            )[]

      Returns void

    • Parameters

      • place: Place
      • dwellTime: number | null

      Returns void

    • Parameters

      • walkSpeedPercent: number

      Returns void

    Constructors

    • Parameters

      • origin: {
            depArrTime?: string;
            individualTransportOption: {
                itModeAndModeOfOperation: {
                    personalMode:
                        | "other"
                        | "foot"
                        | "bicycle"
                        | "car"
                        | "motorcycle"
                        | "truck"
                        | "scooter";
                    personalModeOfOperation: (
                        "self"
                        | "own"
                        | "otherOwned"
                        | "privateLift"
                        | "lease"
                    )[];
                };
                maxDistance?: number;
                maxDuration?: string;
                minDistance?: number;
                minDuration?: string;
                speed?: number;
            }[];
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }
      • destination: {
            depArrTime?: string;
            individualTransportOption: {
                itModeAndModeOfOperation: {
                    personalMode:
                        | "other"
                        | "foot"
                        | "bicycle"
                        | "car"
                        | "motorcycle"
                        | "truck"
                        | "scooter";
                    personalModeOfOperation: (
                        "self"
                        | "own"
                        | "otherOwned"
                        | "privateLift"
                        | "lease"
                    )[];
                };
                maxDistance?: number;
                maxDuration?: string;
                minDistance?: number;
                minDuration?: string;
                speed?: number;
            }[];
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }
      • via: {
            dwellTime?: string;
            viaPoint: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }[] = []
      • params:
            | {
                includeAllRestrictedLines?: boolean;
                includeIntermediateStops?: boolean;
                includeLegProjection?: boolean;
                includeTrackSections?: boolean;
                includeTurnDescription?: boolean;
                lineFilter?: {
                    exclude?: boolean;
                    line: { directionRef?: string; lineRef: string }[];
                };
                modeAndModeOfOperationFilter?: {
                    airSubmode?: string;
                    busSubmode?: string;
                    coachSubmode?: string;
                    exclude?: boolean;
                    funicularSubmode?: string;
                    metroSubmode?: string;
                    personalMode: (
                        | "other"
                        | "foot"
                        | "bicycle"
                        | "car"
                        | "motorcycle"
                        | "truck"
                        | "scooter"
                    )[];
                    ptMode: (
                        | "other"
                        | "unknown"
                        | "air"
                        | "bus"
                        | "coach"
                        | "trolleyBus"
                        | "metro"
                        | "rail"
                        | "tram"
                        | "water"
                        | "ferry"
                        | "cableway"
                        | "funicular"
                        | "lift"
                        | "telecabin"
                    )[];
                    railSubmode?: | "international"
                    | "highSpeedRail"
                    | "interregionalRail"
                    | "railShuttle"
                    | "local"
                    | "vehicleTunnelTransportRailService";
                    telecabinSubmode?: string;
                    tramSubmode?: string;
                    waterSubmode?: string;
                }[];
                numberOfResults?: number;
                numberOfResultsAfter?: number;
                numberOfResultsBefore?: number;
                operatorFilter?: { exclude?: boolean; operatorRef: string[] };
                optimisationMethod?:
                    | "fastest"
                    | "minChanges"
                    | "leastWalking"
                    | "leastCost"
                    | "leastDistance"
                    | "earliestArrival"
                    | "latestDeparture"
                    | "earliestArrivalAndLatestDeparture"
                    | "minNonLevelEntrances"
                    | "minStairs"
                    | "bestForVisualImpairment"
                    | "bestForAuditoryImpairment"
                    | "environmentalSafety"
                    | "extraSafe"
                    | "extraReliable"
                    | "scenic"
                    | "quietTravel";
                useRealtimeData?: "none"
                | "full"
                | "explanatory";
                vehicleFilter?: {
                    exclude?: boolean;
                    trainNumber: string[];
                    vehicleRef: string[];
                };
                walkSpeed?: number;
            }
            | null = null

      Returns TripRequest

    Properties

    mockRequestXML: string | null
    mockResponseXML: string | null
    payload: {
        destination: {
            depArrTime?: string;
            individualTransportOption: {
                itModeAndModeOfOperation: {
                    personalMode:
                        | "other"
                        | "foot"
                        | "bicycle"
                        | "car"
                        | "motorcycle"
                        | "truck"
                        | "scooter";
                    personalModeOfOperation: (
                        "self"
                        | "own"
                        | "otherOwned"
                        | "privateLift"
                        | "lease"
                    )[];
                };
                maxDistance?: number;
                maxDuration?: string;
                minDistance?: number;
                minDuration?: string;
                speed?: number;
            }[];
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        };
        origin: {
            depArrTime?: string;
            individualTransportOption: {
                itModeAndModeOfOperation: {
                    personalMode: | "other"
                    | "foot"
                    | "bicycle"
                    | "car"
                    | "motorcycle"
                    | "truck"
                    | "scooter";
                    personalModeOfOperation: (
                        "self"
                        | "own"
                        | "otherOwned"
                        | "privateLift"
                        | "lease"
                    )[];
                };
                maxDistance?: number;
                maxDuration?: string;
                minDistance?: number;
                minDuration?: string;
                speed?: number;
            }[];
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        };
        params?: {
            includeAllRestrictedLines?: boolean;
            includeIntermediateStops?: boolean;
            includeLegProjection?: boolean;
            includeTrackSections?: boolean;
            includeTurnDescription?: boolean;
            lineFilter?: {
                exclude?: boolean;
                line: { directionRef?: string; lineRef: string }[];
            };
            modeAndModeOfOperationFilter?: {
                airSubmode?: string;
                busSubmode?: string;
                coachSubmode?: string;
                exclude?: boolean;
                funicularSubmode?: string;
                metroSubmode?: string;
                personalMode: (
                    | "other"
                    | "foot"
                    | "bicycle"
                    | "car"
                    | "motorcycle"
                    | "truck"
                    | "scooter"
                )[];
                ptMode: (
                    | "other"
                    | "unknown"
                    | "air"
                    | "bus"
                    | "coach"
                    | "trolleyBus"
                    | "metro"
                    | "rail"
                    | "tram"
                    | "water"
                    | "ferry"
                    | "cableway"
                    | "funicular"
                    | "lift"
                    | "telecabin"
                )[];
                railSubmode?: | "international"
                | "highSpeedRail"
                | "interregionalRail"
                | "railShuttle"
                | "local"
                | "vehicleTunnelTransportRailService";
                telecabinSubmode?: string;
                tramSubmode?: string;
                waterSubmode?: string;
            }[];
            numberOfResults?: number;
            numberOfResultsAfter?: number;
            numberOfResultsBefore?: number;
            operatorFilter?: { exclude?: boolean; operatorRef: string[] };
            optimisationMethod?:
                | "fastest"
                | "minChanges"
                | "leastWalking"
                | "leastCost"
                | "leastDistance"
                | "earliestArrival"
                | "latestDeparture"
                | "earliestArrivalAndLatestDeparture"
                | "minNonLevelEntrances"
                | "minStairs"
                | "bestForVisualImpairment"
                | "bestForAuditoryImpairment"
                | "environmentalSafety"
                | "extraSafe"
                | "extraReliable"
                | "scenic"
                | "quietTravel";
            useRealtimeData?: "none"
            | "full"
            | "explanatory";
            vehicleFilter?: {
                exclude?: boolean;
                trainNumber: string[];
                vehicleRef: string[];
            };
            walkSpeed?: number;
        };
        requestTimestamp: string;
        via: {
            dwellTime?: string;
            viaPoint: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }[];
    }

    The payload object that gets serialized to XML for the request

    requestInfo: RequestInfo

    Methods

    • Builds the XML request string for the TIR

      Parameters

      • language: Language

        The language to use for the request (e.g. "en", "de")

      • requestorRef: string

        The requestor reference identifier

      • xmlConfig: XML_Config

        XML configuration options for building the request, default DefaultXML_Config OJP 2.0

      Returns string

      A formatted XML string representing the Location Information Request