Class GetStateService

The GetStateService implements the AbstractService for the /GetState.csv endpoint.

Hierarchy (view full)

Constructors

Properties

_endpoint: string = '/GetState.csv'

Specific service endpoint.

A path relative to the IServiceConfig.controllerUrl.

_method: Method = 'get'

HTTP request method for this specific service endpoint. See: axios/Method

_requestHeaders: {
    [key: string]: string;
}

Custom HTTP headers.

Custom headers can be defined in form of a key value pair.

this._requestHeaders["Cache-Control"] = "no-cache";

The actual service data object.

log: ILogger

Logger which will be used for all logging events.

Accessors

  • get axiosRequestConfig(): AxiosRequestConfig<any>
  • Get an axios/AxiosRequestConfig object.

    Returns AxiosRequestConfig<any>

  • get url(): string
  • Get the webservice url (joined base url and endpoint).

    Returns string

    URL string (joined base url and endpoint).

Methods

  • Stage request and return the corresponding AxiosPromise.

    Returns AxiosPromise<string>

  • Tells you whether the service has most recent status information or not.

    More accurately it tells you whether the most recent request succeeded or not. So it will return true if the request succeeded and your data is up-to-date. It will return false until the service retrieved its first data and again if a subsequent request fails.

    Returns boolean

  • Set the update interval.

    Parameters

    • milliseconds: number

      Update interval in milliseconds [ms].

    Returns void

  • Start the service.

    This will periodically update the internal data and invoke the optional callables each time new data is received.

    Parameters

    • OptionalsuccessCallback: ((data: GetStateData) => void)

      Will be triggered everytime the service receives new data. The current GetStateData object is passed as parameter to the callback.

    • OptionalerrorCallback: ((e: Error) => void)

      Error callback receives the most recent error as parameter, in case the consecutive error tolerance is hit.

        • (e): void
        • Parameters

          • e: Error

          Returns void

    • OptionalstopOnError: boolean

      Whether to stop in case the consecutive error tolerance is hit. Default behavior (for backward compatibility) is to keep running in any case.

    Returns void