Constructor.
Optionalenvironment: HostConfigInfothe optional initial environment to use;
if a non-Environment object is passed then the properties of that object will
be used to construct a new Environment instance
Get the environment configuration.
Get a parameters object that can be used to hold URL variables.
The publicQuery environment parameter.
Generate a URL for adding (merging) datum metadata via a POST request.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter of this instance will be used
OptionalsourceId: stringa specific source ID to use; if not provided the sourceId parameter of this instance will be used
the URL
Generate a URL for finding the available source IDs for a node or metadata filter.
OptionaldatumFilter: DatumFilterthe search criteria, which can define nodeId, startDate, endDate,
and metadataFilter properties to limit the results to; if nodeId not
provided the nodeIds parameter of this instance will be used
OptionalwithNodeIds: booleanif true then force the response to include node IDs along with source IDs,
instead of just source IDs
the URL
the base URL to the REST API
Get a new DatumFilter configured with parameters of this instance.
This will look for the following parameters:
nodeIdssourceIdsthe filter
Generate a URL for querying for datum reading values.
The datumFilter must provide the required date(s) to use for the
reading type. If the reading type only requires one date, then the
Domain.DatumFilter#startDate or
Domain.DatumFilter#endDate value should be provided.
the type of reading to find
OptionaldatumFilter: DatumFilterthe search criteria; if not provided then this.datumFilter() will be used
Optionaltolerance: stringoptional query tolerance to use
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Generate a URL for deleting datum metadata via a DELETE request.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter of this instance will be used
OptionalsourceId: stringa specific source ID to use; if not provided the sourceId parameter of this instance will be used
the URL
Get an environment parameter.
This is a shortcut for calling Util.Configuration#value on the
environment object.
the environment parameter name to get
the environment parameter value
Set an environment parameter.
This is a shortcut for calling Util.Configuration#value on the
environment object.
the environment parameter name to set
the value to set
the environment object
Generate a URL for searching for datum metadata.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter of this instance will be used
OptionalsourceId: stringa specific source ID to use;
if not provided the sourceId parameter of this instance will be used;
if null then ignore any sourceId property of this class
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Generate a URL for searching for node metadata.
OptionalnodeId: null | number | number[]a specific node ID, or array of node IDs, to use; if not provided the nodeIds
property of this class will be used, unless null is passed in which case no node IDs will be
added to the URL so that all available node metadata objects will be returned
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Generate a URL for finding the available source IDs.
OptionaldatumFilter: DatumFilterthe search criteria, which can define nodeId, startDate, endDate,
localStartDate, localEndDdate, metadataFilter, propertyNames,
instantaneousPropertyNames, accumulatingPropertyNames, and
statusPropertyNames, properties to limit the results to
the URL
Get a URL for just the SolarNet host, without any path to be used for actual requests.
Calls the toRequestUrl() with hostUrl() as the argument.
the URL to make reqeusts to the SolarNet host
Get a URL for just the SolarNet host, without any path.
This method constructs an absolute URL based on the following properties configured on this instance's Net.Environment:
true then
use HTTPS as the protocol, otherwise HTTP.host for the host name or IP address.port for the port if available and not the standard 443 for
HTTPS or 80 for HTTP.the URL to the SolarNet host
Get a URL for just the SolarNet host using the WebSocket protocol, without any path.
This method constructs an absolute URL based on the following properties configured on this instance's Net.Environment:
true then
use WSS as the protocol, otherwise WS.host for the host name or IP address.port for the port if available and not the standard 443 for
WSS or 80 for WS.the URL to the SolarNet host WebSocket
Generate a URL to get a list of all active node IDs available to the requesting user.
Note this method only works against the /sec version of the API endpoint.
the URL to access the node IDs the requesting user has access to
Generate a URL for querying for datum, in either raw or aggregate form.
If the datumFilter has an aggregate value set, then aggregate results will be
returned by SolarNet.
OptionaldatumFilter: DatumFilterthe search criteria; if not provided then this.datumFilter() will be used
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Generate a URL for querying for the most recent datum.
OptionaldatumFilter: DatumFilterthe search criteria; if not provided then this.datumFilter() will be used
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Get a parameter, with plural suffix array support.
This method will first look for a parameter named exactly key, and if found
return that. Otherwise it will look for an array parameter named key with
s appended, and if found return the first element from that array. For example:
const helper = new UrlHelper();
helper.parameter('nodeIds', [1, 2, 3]);
helper.param('nodeIds'); // [1, 2, 3]
helper.param('nodeId'); // 1
If key already ends in s, then a desired array result is assumed. If a
value is not found for the parameter, then s is removed from key and
that parameter value is returned, as an array if it is not already. For example:
const helper = new UrlHelper();
helper.parameter('nodeId', 1);
helper.param('nodeIds'); // [1]
helper.param('nodeId'); // 1
the expected type
the parameter name to get
the parameter value
Get a parameter.
This is a shortcut for calling Util.Configuration#value on the
parameters object.
the parameter name to get
the parameter value
Set a parameter.
This is a shortcut for calling Util.Configuration#value on the
parameters object.
the parameter name to set
the value to set
the parameters object
Generate a URL for setting datum metadata via a PUT request.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter of this instance will be used
OptionalsourceId: stringa specific source ID to use; if not provided the sourceId parameter of this instance will be used
the URL
Generate a URL for the "reportable interval" for a node, optionally limited to a specific set of source IDs.
If no source IDs are provided, then the reportable interval query will return an interval for all available sources.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter will be used
OptionalsourceIds: string[]an array of source IDs to limit query to; if not provided the sourceIds parameter will be used
the URL
Replace occurances of URL template variables with values from the parameters
property and append to the host URL.
This method provides a way to resolve an absolute URL based on the configured environment and parameters on this object.
a URL path template
an absolute URL
Replace occurances of URL template variables with values from the parameters
property.
URL template variables are specified as {<em>name</em>}. The variable
will be replaced by the value associated with property name in the
parameters object. The value will be URI encoded.
a URL template
the URL with template variables resolved
Generate a URL for querying for stream datum, in either raw or aggregate form.
If the datumFilter has an aggregate value set, then aggregate results will be
returned by SolarNet.
OptionaldatumFilter: DatumFilterthe search criteria; if not provided then this.datumFilter() will be used
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Generate a URL for querying for stream reading values.
The datumFilter must provide the required date(s) to use for the
reading type. If the reading type only requires one date, then the
Domain.DatumFilter#startDate or
Domain.DatumFilter#endDate value should be provided.
the type of reading to find
OptionaldatumFilter: DatumFilterthe search criteria; if not provided then this.datumFilter() will be used
Optionaltolerance: stringoptional query tolerance to use
Optionalsorts: SortDescriptor[]optional sort settings to use
Optionalpagination: Paginationoptional pagination settings to use
the URL
Get the URL to actually request, incorporating the environment's proxyUrlPrefix if available.
If a environment.proxyUrlPrefix value is configured,
this will re-write the URL to use that host prefix, otherwise url will be returned
unchanged.
the URL to make reqeusts to the SolarNet host
Generate a URL for viewing datum metadata.
If no sourceId is provided, then the API will return all available datum metadata for all sources.
OptionalnodeId: numbera specific node ID to use; if not provided the nodeId parameter of this instance will be used
OptionalsourceId: stringa specific source ID to use;
if not provided the sourceId parameter of this instance will be used;
if null then ignore any sourceId property of this class
the URL
Generate a URL for viewing a specific user's metadata via a GET request.
Note this URL is similar to Net.SolarUserApi#viewUserMetadataUrl but is for the read-only SolarQuery API, rather than the read-write SolarUser API.
OptionaluserId: numbera specific user ID;
if not provided the userId parameter of this instance will be used
the URL
StaticresolveReplace occurances of URL template variables with values from a parameter object.
URL template variables are specified as {<em>name</em>}. The variable
will be replaced by the value associated with property name in the
provided parameter object. The value will be URI encoded.
Any occurances of // after replacing template variables will be reduced to /.
a URL template
an object whose properties should serve as template variables
the URL
The SolarQuery API URL helper.