ojp-sdk
    Preparing search index...

    Class TripRefineRequest

    TripRefineRequest (TRR) class

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

    • initWithTrip - use a Trip OJP XSD schema to refine

    Hierarchy

    Index

    Initialization

    • 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>');
      

    Constructors

    • Parameters

      • tripResult: {
            id: string;
            trip: {
                cancelled?: boolean;
                delayed?: boolean;
                deviation?: boolean;
                distance?: number;
                duration: string;
                endTime: string;
                id: string;
                infeasible?: boolean;
                leg: {
                    continuousLeg?: {
                        duration: string;
                        legEnd: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legStart: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legTrack?: {
                            trackSection: {
                                duration?: (...)
                                | (...);
                                length?: (...) | (...);
                                linkProjection?: (...) | (...);
                                roadName?: (...) | (...);
                                trackSectionEnd?: (...) | (...);
                                trackSectionStart?: (...) | (...);
                            }[];
                        };
                        length?: number;
                        pathGuidance?: {
                            pathGuidanceSection: {
                                guidanceAdvice?: (...)
                                | (...);
                                roadName?: (...) | (...);
                                trackSection?: (...) | (...);
                                turnAction?: (...) | (...);
                                turnDescription?: (...) | (...);
                            }[];
                        };
                        service: {
                            personalMode: | "other"
                            | "foot"
                            | "bicycle"
                            | "car"
                            | "motorcycle"
                            | "truck"
                            | "scooter";
                            personalModeOfOperation: | "self"
                            | "own"
                            | "otherOwned"
                            | "privateLift"
                            | "lease";
                        };
                    };
                    duration?: string;
                    emissionCO2?: { kilogramPerPersonKm: number };
                    id: string;
                    timedLeg?: {
                        legAlight: {
                            estimatedQuay?: { text: string };
                            expectedDepartureOccupancy?: {
                                fareClass: (...) | (...) | (...);
                                occupancyLevel: (...) | (...) | (...) | (...) | (...);
                            }[];
                            nameSuffix?: { text: string };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: string };
                            requestStop?: boolean;
                            serviceArrival: { estimatedTime?: string; timetabledTime: string };
                            serviceDeparture?: { estimatedTime?: string; timetabledTime: string };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        };
                        legBoard: {
                            estimatedQuay?: { text: string };
                            expectedDepartureOccupancy?: {
                                fareClass: (...) | (...) | (...);
                                occupancyLevel: (...) | (...) | (...) | (...) | (...);
                            }[];
                            nameSuffix?: { text: string };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: string };
                            requestStop?: boolean;
                            serviceArrival?: { estimatedTime?: string; timetabledTime: string };
                            serviceDeparture: { estimatedTime?: string; timetabledTime: string };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        };
                        legIntermediate: {
                            estimatedQuay?: { text: string };
                            expectedDepartureOccupancy?: { fareClass: ...; occupancyLevel: ... }[];
                            nameSuffix?: { text: string };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: string };
                            requestStop?: boolean;
                            serviceArrival: { estimatedTime?: string; timetabledTime: string };
                            serviceDeparture: { estimatedTime?: string; timetabledTime: string };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        }[];
                        legTrack?: {
                            trackSection: {
                                duration?: (...)
                                | (...);
                                length?: (...) | (...);
                                linkProjection?: (...) | (...);
                                roadName?: (...) | (...);
                                trackSectionEnd?: (...) | (...);
                                trackSectionStart?: (...) | (...);
                            }[];
                        };
                        service: {
                            attribute: {
                                code: string;
                                hireFacility?: string;
                                importance?: number;
                                userText: { text: string };
                            }[];
                            cancelled?: boolean;
                            conventionalModeOfOperation?: string;
                            destinationStopPointRef?: string;
                            destinationText?: { text: string };
                            deviation?: boolean;
                            directionRef?: string;
                            journeyRef: string;
                            lineRef: string;
                            mode: {
                                airSubmode?: string;
                                busSubmode?: string;
                                coachSubmode?: string;
                                funicularSubmode?: string;
                                metroSubmode?: string;
                                name?: { text: string };
                                ptMode:
                                    | "other"
                                    | "unknown"
                                    | "air"
                                    | "bus"
                                    | "coach"
                                    | "trolleyBus"
                                    | "metro"
                                    | "rail"
                                    | "tram"
                                    | "water"
                                    | "ferry"
                                    | "cableway"
                                    | "funicular"
                                    | "lift"
                                    | "telecabin";
                                railSubmode?: | "international"
                                | "highSpeedRail"
                                | "interregionalRail"
                                | "railShuttle"
                                | "local"
                                | "vehicleTunnelTransportRailService";
                                shortName?: { text: string };
                                telecabinSubmode?: string;
                                tramSubmode?: string;
                                waterSubmode?: string;
                            };
                            operatingDayRef: string;
                            operatorRef?: string;
                            originText: { text: string };
                            productCategory?: {
                                name?: { text: ... };
                                productCategoryRef?: string;
                                shortName?: { text: ... };
                            };
                            publicCode?: string;
                            publishedServiceName: { text: string };
                            situationFullRefs?: {
                                situationFullRef: { participantRef: ...; situationNumber: ... }[];
                            };
                            trainNumber?: string;
                            unplanned?: boolean;
                        };
                    };
                    transferLeg?: {
                        duration: string;
                        legEnd: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legStart: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        length?: number;
                        pathGuidance?: {
                            pathGuidanceSection: {
                                guidanceAdvice?: (...)
                                | (...);
                                roadName?: (...) | (...);
                                trackSection?: (...) | (...);
                                turnAction?: (...) | (...);
                                turnDescription?: (...) | (...);
                            }[];
                        };
                        transferType: "walk"
                        | "remainInVehicle"
                        | "changeWithinVehicle";
                    };
                }[];
                startTime: string;
                transfers: number;
                unplanned?: boolean;
            };
        }
      • OptionalrefineParams: {
            includeAllRestrictedLines?: boolean;
            includeIntermediateStops?: boolean;
            includeLegProjection?: boolean;
            includeTurnDescription?: boolean;
            numberOfResults?: number;
            useRealtimeData?: "none" | "full" | "explanatory";
        }

      Returns TripRefineRequest

    Properties

    mockRequestXML: string | null
    mockResponseXML: string | null
    payload: {
        refineParams?: {
            includeAllRestrictedLines?: boolean;
            includeIntermediateStops?: boolean;
            includeLegProjection?: boolean;
            includeTurnDescription?: boolean;
            numberOfResults?: number;
            useRealtimeData?: "none" | "full" | "explanatory";
        };
        requestTimestamp: string;
        tripResult: {
            id: string;
            trip: {
                cancelled?: boolean;
                delayed?: boolean;
                deviation?: boolean;
                distance?: number;
                duration: string;
                endTime: string;
                id: string;
                infeasible?: boolean;
                leg: {
                    continuousLeg?: {
                        duration: string;
                        legEnd: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legStart: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legTrack?: {
                            trackSection: {
                                duration?: ...;
                                length?: ...;
                                linkProjection?: ...;
                                roadName?: ...;
                                trackSectionEnd?: ...;
                                trackSectionStart?: ...;
                            }[];
                        };
                        length?: number;
                        pathGuidance?: {
                            pathGuidanceSection: {
                                guidanceAdvice?: ...;
                                roadName?: ...;
                                trackSection?: ...;
                                turnAction?: ...;
                                turnDescription?: ...;
                            }[];
                        };
                        service: {
                            personalMode: | "other"
                            | "foot"
                            | "bicycle"
                            | "car"
                            | "motorcycle"
                            | "truck"
                            | "scooter";
                            personalModeOfOperation: | "self"
                            | "own"
                            | "otherOwned"
                            | "privateLift"
                            | "lease";
                        };
                    };
                    duration?: string;
                    emissionCO2?: { kilogramPerPersonKm: number };
                    id: string;
                    timedLeg?: {
                        legAlight: {
                            estimatedQuay?: { text: string };
                            expectedDepartureOccupancy?: { fareClass: ...; occupancyLevel: ... }[];
                            nameSuffix?: { text: string };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: string };
                            requestStop?: boolean;
                            serviceArrival: { estimatedTime?: string; timetabledTime: string };
                            serviceDeparture?: {
                                estimatedTime?: (...) | (...);
                                timetabledTime: string;
                            };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        };
                        legBoard: {
                            estimatedQuay?: { text: string };
                            expectedDepartureOccupancy?: { fareClass: ...; occupancyLevel: ... }[];
                            nameSuffix?: { text: string };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: string };
                            requestStop?: boolean;
                            serviceArrival?: {
                                estimatedTime?: (...) | (...);
                                timetabledTime: string;
                            };
                            serviceDeparture: { estimatedTime?: string; timetabledTime: string };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        };
                        legIntermediate: {
                            estimatedQuay?: { text: ... };
                            expectedDepartureOccupancy?: (...)[];
                            nameSuffix?: { text: ... };
                            noAlightingAtStop?: boolean;
                            noBoardingAtStop?: boolean;
                            notServicedStop?: boolean;
                            order?: number;
                            plannedQuay?: { text: ... };
                            requestStop?: boolean;
                            serviceArrival: {
                                estimatedTime?: (...) | (...);
                                timetabledTime: string;
                            };
                            serviceDeparture: {
                                estimatedTime?: (...)
                                | (...);
                                timetabledTime: string;
                            };
                            stopPointName: { text: string };
                            stopPointRef: string;
                            unplannedStop?: boolean;
                        }[];
                        legTrack?: {
                            trackSection: {
                                duration?: ...;
                                length?: ...;
                                linkProjection?: ...;
                                roadName?: ...;
                                trackSectionEnd?: ...;
                                trackSectionStart?: ...;
                            }[];
                        };
                        service: {
                            attribute: {
                                code: string;
                                hireFacility?: (...)
                                | (...);
                                importance?: (...) | (...);
                                userText: { text: ... };
                            }[];
                            cancelled?: boolean;
                            conventionalModeOfOperation?: string;
                            destinationStopPointRef?: string;
                            destinationText?: { text: string };
                            deviation?: boolean;
                            directionRef?: string;
                            journeyRef: string;
                            lineRef: string;
                            mode: {
                                airSubmode?: string;
                                busSubmode?: string;
                                coachSubmode?: string;
                                funicularSubmode?: string;
                                metroSubmode?: string;
                                name?: { text: ... };
                                ptMode:
                                    | "other"
                                    | "unknown"
                                    | "air"
                                    | "bus"
                                    | "coach"
                                    | "trolleyBus"
                                    | "metro"
                                    | "rail"
                                    | "tram"
                                    | "water"
                                    | "ferry"
                                    | "cableway"
                                    | "funicular"
                                    | "lift"
                                    | "telecabin";
                                railSubmode?: | "international"
                                | "highSpeedRail"
                                | "interregionalRail"
                                | "railShuttle"
                                | "local"
                                | "vehicleTunnelTransportRailService";
                                shortName?: { text: ... };
                                telecabinSubmode?: string;
                                tramSubmode?: string;
                                waterSubmode?: string;
                            };
                            operatingDayRef: string;
                            operatorRef?: string;
                            originText: { text: string };
                            productCategory?: {
                                name?: (...) | (...);
                                productCategoryRef?: (...) | (...);
                                shortName?: (...) | (...);
                            };
                            publicCode?: string;
                            publishedServiceName: { text: string };
                            situationFullRefs?: { situationFullRef: (...)[] };
                            trainNumber?: string;
                            unplanned?: boolean;
                        };
                    };
                    transferLeg?: {
                        duration: string;
                        legEnd: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        legStart: {
                            geoPosition?: { latitude: number; longitude: number };
                            name: { text: string };
                            stopPlaceRef?: string;
                            stopPointRef?: string;
                        };
                        length?: number;
                        pathGuidance?: {
                            pathGuidanceSection: {
                                guidanceAdvice?: ...;
                                roadName?: ...;
                                trackSection?: ...;
                                turnAction?: ...;
                                turnDescription?: ...;
                            }[];
                        };
                        transferType: "walk"
                        | "remainInVehicle"
                        | "changeWithinVehicle";
                    };
                }[];
                startTime: string;
                transfers: number;
                unplanned?: boolean;
            };
        };
    }

    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