ojp-sdk
    Preparing search index...

    Class LocationInformationRequest

    LocationInformationRequest (LIR) class

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

    • initWithLocationName - use location name, i.e. Bern
    • initWithPlaceRef - use place ref or literal coordinates (lat, lng)
    • initWithBBOX - use bounding box to filter locations

    Hierarchy

    Index

    Initialization

    • Inits LIR with bounding box

      Parameters

      • bboxData: string | number[]

        bounding box data as string ("minLon,minLat,maxLon,maxLat") or array [minLon, minLat, maxLon, maxLat]

      • placeTypes: ("location" | "stop" | "address" | "poi" | "topographicPlace")[] = []

        OJP_Types.PlaceTypeEnum "stop" | "address" | "poi" | "location" | "topographicPlace"

      • numberOfResults: number = 10

        maximum number of results to return (default: 10)

      Returns LocationInformationRequest

    • Inits LIR with location name

      Parameters

      • name: string

        string, location name

      • placeTypes: ("location" | "stop" | "address" | "poi" | "topographicPlace")[] = []

        OJP_Types.PlaceTypeEnum "stop" | "address" | "poi" | "location" | "topographicPlace"

      • numberOfResults: number = 10

        maximum number of results to return (default: 10)

      Returns LocationInformationRequest

    • Inits LIR with place ref or literal coords

      Parameters

      • placeRefOrCoords: string

        place reference or coordinates string (e.g. ch:1:sloid:7000:4:7 or 46.94857,7.43683 (latitude, longitude in WGS84))

      • numberOfResults: number = 10

        maximum number of results to return (default: 10)

      Returns LocationInformationRequest

    • 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

      • restrictions:
            | {
                includePtModes?: boolean;
                modes?: {
                    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;
                pointOfInterestFilter?: {
                    exclude?: boolean;
                    pointOfInterestCategory: {
                        osmTag: { tag: string; value: string }[];
                        pointOfInterestClassification: string[];
                    }[];
                };
                type: ("location" | "stop" | "address" | "poi" | "topographicPlace")[];
            }
            | undefined

      Returns LocationInformationRequest

    Properties

    mockRequestXML: string | null
    mockResponseXML: string | null
    payload: {
        initialInput?: {
            geoRestriction?: {
                rectangle: {
                    lowerRight: { latitude: number; longitude: number };
                    upperLeft: { latitude: number; longitude: number };
                };
            };
            name?: string;
        };
        placeRef?: {
            geoPosition?: { latitude: number; longitude: number };
            name: { text: string };
            stopPlaceRef?: string;
            stopPointRef?: string;
        };
        requestTimestamp: string;
        restrictions?: {
            includePtModes?: boolean;
            modes?: {
                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;
            pointOfInterestFilter?: {
                exclude?: boolean;
                pointOfInterestCategory: {
                    osmTag: { tag: string; value: string }[];
                    pointOfInterestClassification: string[];
                }[];
            };
            type: ("location" | "stop" | "address" | "poi" | "topographicPlace")[];
        };
    }

    The payload object that gets serialized to XML for the request

    requestInfo: RequestInfo

    Methods

    • Builds the XML request string for the LIR

      Parameters

      • language: Language

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

      • requestorRef: string

        The requestor reference identifier

      • xmlConfig: XML_Config = DefaultXML_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

    • Parameters

      • restrictions: {
            includePtModes?: boolean;
            modes?: {
                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;
            pointOfInterestFilter?: {
                exclude?: boolean;
                pointOfInterestCategory: {
                    osmTag: { tag: string; value: string }[];
                    pointOfInterestClassification: string[];
                }[];
            };
            type: ("location" | "stop" | "address" | "poi" | "topographicPlace")[];
        }
      • placeTypes: ("location" | "stop" | "address" | "poi" | "topographicPlace")[]
      • numberOfResults: number

      Returns void

    • Parameters

      • bboxData: string | number[]

      Returns
          | {
              rectangle: {
                  lowerRight: { latitude: number; longitude: number };
                  upperLeft: { latitude: number; longitude: number };
              };
          }
          | null

    • Returns {
          includePtModes?: boolean;
          modes?: {
              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;
          pointOfInterestFilter?: {
              exclude?: boolean;
              pointOfInterestCategory: {
                  osmTag: { tag: string; value: string }[];
                  pointOfInterestClassification: string[];
              }[];
          };
          type: ("location" | "stop" | "address" | "poi" | "topographicPlace")[];
      }