ojp-sdk
    Preparing search index...

    Class OJPv1_TripRequest

    TripRequest (TR) class for OJP 1.0

    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 OJPv1_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

    • This modifier works only in OJP 2.0

      Parameters

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

      Returns void

    • This modifier works only in OJP 2.0

      Parameters

      • maxDurationMinutes: number | undefined
      • endpointType: EndpointType

      Returns void

    • This modifier works only in OJP 2.0

      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

      Returns void

    • This modifier works only in OJP 2.0

      Parameters

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

      Returns void

    • Parameters

      • place: Place
      • dwellTime: number | null

      Returns void

    • This modifier works only in OJP 2.0

      Parameters

      • walkSpeedPercent: number

      Returns void

    Constructors

    • Parameters

      • origin: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }
      • destination: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }
      • via: {
            dwellTime?: string;
            viaPoint: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }[] = []
      • params:
            | {
                includeAllRestrictedLines?: boolean;
                includeIntermediateStops?: boolean;
                includeLegProjection?: boolean;
                includeTrackSections?: boolean;
                includeTurnDescription?: boolean;
                itModesToCover?: string[];
                numberOfResults?: number;
                numberOfResultsAfter?: number;
                numberOfResultsBefore?: number;
                ptModeFilter?: {
                    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;
                }[];
                walkSpeed?: number;
            }
            | null = null

      Returns OJPv1_TripRequest

    Properties

    mockRequestXML: string | null
    mockResponseXML: string | null
    payload: {
        destination: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        };
        origin: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        };
        params?: {
            includeAllRestrictedLines?: boolean;
            includeIntermediateStops?: boolean;
            includeLegProjection?: boolean;
            includeTrackSections?: boolean;
            includeTurnDescription?: boolean;
            itModesToCover?: string[];
            numberOfResults?: number;
            numberOfResultsAfter?: number;
            numberOfResultsBefore?: number;
            ptModeFilter?: {
                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;
            }[];
            walkSpeed?: number;
        };
        requestTimestamp: string;
        via: {
            dwellTime?: string;
            viaPoint: {
                geoPosition?: { latitude: number; longitude: number };
                locationName: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }[];
    }

    The payload object that gets serialized to XML for the request (OJP v1)

    requestInfo: RequestInfo

    Methods

    • Builds the XML request string for the TR

      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 XML_BuilderConfigOJPv1 OJP 1.0

      Returns string

      A formatted XML string representing the Location Information Request