Skip to main content

PolledHTTPResource

Description of an external HTTP endpoint and how to poll it.

The URL of the external resource is formed by appending the given base url and the result of encodeParams(params) where params are the parameters provided to Context#useExternalResource

Properties​

conv()​

conv: (data) => Entry<Json, Json>[];

Function to convert data received from external resource to key-value entries.

Parameters​

ParameterType
dataJson

Returns​

Entry<Json, Json>[]


encodeParams()?​

optional encodeParams: (params) => string;

Function to use to encode params of type Json for external resource request.

Note that the result of encodeParams may contain a ? separator, but it need not be at the beginning of the returned string, so some parameters can be used in part of the URL preceding the ?.

Parameters​

ParameterType
paramsJson

Returns​

string


interval​

interval: number;

The interval of time to wait before refreshing the data, given in milliseconds


options?​

optional options: object;

Optional parameters: additional headers to add to request, and timeout for request, in milliseconds. (default 1000ms)

headers?​

optional headers: object;
Index Signature​
[header: string]: string

timeout?​

optional timeout: number;

url​

url: string;

Base URL of resource to poll.