ojp-sdk
    Preparing search index...

    Class StopEventRequest

    StopEventRequest (SER) class

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

    • initWithPlaceRefAndDate - use PlaceRef ids + date

    Hierarchy

    Index

    Initialization

    • Creates a new StopEventRequest with the given place reference and date

      Parameters

      • placeRefS: string

        The stop point reference ID (e.g. "8507000" for Bern)

      • date: Date = ...

        The date and time for the stop event request (defaults to current date/time)

      Returns StopEventRequest

      A new StopEventRequest instance

      const request = StopEventRequest.initWithPlaceRefAndDate('8507000');
      const response = await request.fetch(sdk);
    • 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

      • location: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        }
      • params:
            | {
                includeAllRestrictedLines?: boolean;
                includeOnwardCalls?: boolean;
                includePreviousCalls?: boolean;
                numberOfResults?: number;
                stopEventType?: "both"
                | "departure"
                | "arrival";
                useRealtimeData?: "none" | "full" | "explanatory";
            }
            | undefined = undefined

      Returns StopEventRequest

    Properties

    mockRequestXML: string | null
    mockResponseXML: string | null
    payload: {
        location: {
            depArrTime?: string;
            placeRef: {
                geoPosition?: { latitude: number; longitude: number };
                name: { text: string };
                stopPlaceRef?: string;
                stopPointRef?: string;
            };
        };
        params?: {
            includeAllRestrictedLines?: boolean;
            includeOnwardCalls?: boolean;
            includePreviousCalls?: boolean;
            numberOfResults?: number;
            stopEventType?: "both"
            | "departure"
            | "arrival";
            useRealtimeData?: "none" | "full" | "explanatory";
        };
        requestTimestamp: string;
    }

    The payload object that gets serialized to XML for the request

    requestInfo: RequestInfo

    Methods

    • Builds the XML request string for the SER

      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

    • Parameters

      Returns {
          includeAllRestrictedLines?: boolean;
          includeOnwardCalls?: boolean;
          includePreviousCalls?: boolean;
          numberOfResults?: number;
          stopEventType?: "both" | "departure" | "arrival";
          useRealtimeData?: "none" | "full" | "explanatory";
      }