new DatumSourceFinder(urlHelpers [, authBuilder])
Constructor.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
urlHelpers |
NodeDatumUrlHelper | Array.<NodeDatumUrlHelper> | the helper(s) to find the avaialble sources for |
|
authBuilder |
AuthorizationV2Builder |
<optional> |
the auth builder to authenticate requests with; if not provided then only public data can be queried; when provided a pre-signed key must be available |
Examples
// the simple case, all available sources for just one SolarNode const urlHelper = new NodeDatumUrlHelper(); urlHelper.publicQuery = true; urlHelper.nodeId = 123; const sources = await new DatumSourceFinder(urlHelper).fetch();
// find all sources matching a wildcard pattern within the past day const filter = new DatumFilter(); filter.startDate = new Date(Date.now() - 24 * 60 * 60 * 1000); filter.sourceId = '/power/**'; const sources2 = await new DatumSourceFinder(urlHelper).filter(filter).fetch();
// find all sources across multiple SolarNodes const urlHelper2 = new NodeDatumUrlHelper(); urlHelper2.publicQuery = true; urlHelper2.nodeId = 234; const sources3 = await new DatumSourceFinder([urlHelper, urlHelper2]).fetch();
Members
-
<static, readonly> version :string
-
The class version.
Type:
- string
Methods
-
filter( [value])
-
Get or set a
DatumFilter
to limit the query with.The
startDate
,endDate
, andmetadataFilter
properties can be used to limit the query scope.Parameters:
Name Type Argument Description value
DatumFilter <optional>
the datum filter to use
Returns:
when used as a getter, the filter, otherwise this object
- Type
- function | DatumFilter
-
load(callback)
-
Asynchronously find the available datum range using a callback.
Parameters:
Name Type Description callback
DatumSourceFinder~dataCallback the callback function to invoke
Returns:
- Type
- void
Type Definitions
-
dataCallback( [error], data)
-
The data callback function.
Parameters:
Name Type Argument Description error
Error <optional>
an error if a failure occurred
data
object the result data, with node ID keys and
string[]
values representing the source IDs