Home Manual Reference Source Test Repository
public class | source

DatapointsSearchBuilder

Extends:

SearchBuilder → DatapointsSearchBuilder

Defined a search over Datastreams

Example:

ogapi.datapointsSearchBuilder()

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

tagsFilter: *[]

Method Summary

Public Methods
public

betweenDates(fromDate: date, toDate: date): DatapointsSearchBuilder

Set time window to search

public

The search request will have this filter

public

Set datastreamId to search

public

Set deviceId to search

public

Set feedName to search

Inherited Summary

From class SearchBuilder
public

[route]: *

public

Add ascending param into the sort search object

public

addSortBy(filterField: string, typeSort: string): SearchBuilder

Add ascending/descending param into the sort search object

public

Add descending param into the sort search object

public

Build a instance of Search

public

The search request will have this filter

public

findAllFields(input: *): Promise

Return a promise which it will contains an array with fields recommended with complete structure

public

findFieldPath(field: *): Promise

Return a promise which it will contains an string with the path of a field

public

findFields(input: *): Promise

Return a promise which it will contains an array with fields recommended with only identifier

public

limit(size: number, start: number): SearchBuilder

Set reponse pagination.

public

Remove sort param from the search object

public

The request will have a specific time out if it will be exceeded then the promise throw an exception

Public Constructors

public constructor(parent: InternalOpenGateAPI) source

Constructor

Override:

SearchBuilder#constructor

Params:

NameTypeAttributeDescription
parent InternalOpenGateAPI
  • nullable: false

Instance of our InternalOpenGateAPI

Public Members

public fluentFilter: * source

public tagsFilter: *[] source

Public Methods

public betweenDates(fromDate: date, toDate: date): DatapointsSearchBuilder source

Set time window to search

Params:

NameTypeAttributeDescription
fromDate date
  • nullable: false

Add from date

toDate date
  • nullable: false

Add to date

Throw:

Error

throw error when fromDate or toDate is not typeof date

Example:

ogapi.datapointsSearchBuilder().withDeviceId('myDevice').build()

public select(select: SelectBuilder | object): SearchBuilder source

The search request will have this filter

Params:

NameTypeAttributeDescription
select SelectBuilder | object
  • nullable: false

Return:

SearchBuilder

Example:

 ogapi.entitiesSearchBuilder().select(
     ogapi.newSelectBuilder().add(SE.element("provision.device.identifier", ["value"], "id"), SE.add("device.temperature.value", ["value"]))
 ) // Setting SelectBuilder
 ogapi.entitiesSearchBuilder().select({ "elements": [{"name": "provision.device.identifier",
	"fields": [{"field": "value","alias": "identifier"}]},
     {"name": "device.temperature.value","fields": [{"field": "value","alias": "identifier"}]}]
  }) //Custom select

public withDatastream(datastreamId: string): DatapointsSearchBuilder source

Set datastreamId to search

Params:

NameTypeAttributeDescription
datastreamId string
  • nullable: false

Datastream.id of Datapoint

Throw:

Error

throw error when datastreamId is not typeof string

Example:

ogapi.datapointsSearchBuilder().withDeviceId('myDevice').build()

public withDeviceId(deviceId: string): DatapointsSearchBuilder source

Set deviceId to search

Params:

NameTypeAttributeDescription
deviceId string
  • nullable: false

Prov.customId of Device

Throw:

Error

throw error when deviceId is not typeof string

Example:

ogapi.datapointsSearchBuilder().withDeviceId('myDevice').build()

public withFeed(feedId: string): DatapointsSearchBuilder source

Set feedName to search

Params:

NameTypeAttributeDescription
feedId string
  • nullable: false

Datastream.id of Datapoint

Throw:

Error

throw error when datastreamId is not typeof string

Example:

ogapi.datapointsSearchBuilder().withDeviceId('myDevice').build()