import SearchBuilder from 'opengate-js/src/searching/builder/SearchBuilder.js'SearchBuilder
Direct Subclass:
Indirect Subclass:
This is a abstract class. It is a base to make all kind of search request to OpenGate North API.
Constructor Summary
| Public Constructor | ||
| public |
constructor(parent: InternalOpenGateAPI, routes: object) Constructor |
|
Member Summary
| Public Members | ||
| public |
[route]: * |
|
Method Summary
| Public Methods | ||
| public |
addSortAscendingBy(filterField: string): SearchBuilder 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 |
addSortDescendingBy(filterField: string): SearchBuilder Add descending param into the sort search object |
|
| public |
Build a instance of Search |
|
| public |
filter(filter: FilterBuilder | object): SearchBuilder 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 |
removeSortBy(filterField: string): SearchBuilder Remove sort param from the search object |
|
| public |
withTimeout(ms: number): SearchBuilder 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, routes: object) source
Constructor
Params:
| Name | Type | Attribute | Description |
| parent | InternalOpenGateAPI |
|
this is ogapi instance |
| routes | object |
|
this defined the routes. One of those routes must be called on Builder before call build method. |
Public Members
public [route]: * source
Public Methods
public addSortAscendingBy(filterField: string): SearchBuilder source
Add ascending param into the sort search object
Params:
| Name | Type | Attribute | Description |
| filterField | string |
|
This field must be allowed into the specific resource |
Example:
ogapi.subscriptionsSearchBuilder().addSortAscendingBy('prov.customid') // Order by prov.customid Ascending
public addSortBy(filterField: string, typeSort: string): SearchBuilder source
Add ascending/descending param into the sort search object
Example:
ogapi.subscriptionsSearchBuilder().addSortBy('prov.customid','ASCENDING') // Order by prov.customid Ascending
ogapi.devicesSearchBuilder().addSortBy('prov.customid','DESCENDING') // Order by prov.customid Descending
public addSortDescendingBy(filterField: string): SearchBuilder source
Add descending param into the sort search object
Params:
| Name | Type | Attribute | Description |
| filterField | string |
|
This field must be allowed into the specific resource |
Example:
ogapi.devicesSearchBuilder().addSortDescendingBy('prov.customid') // Order by prov.customid Descending
public build(): Search source
Build a instance of Search
Throw:
Throw error on url build |
Example:
ogapi.devicesSearchBuilder().onProvisioned().build()
Test:
- Check funcionality newSearchBuilder module: Check on entity searching: using filterBuilder:
- Check funcionality newSearchBuilder module: Check on entity searching: On collected and provisioned data:
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On sort: Ascending sort
- Check funcionality newSearchBuilder module: Check on entity searching: On sort: Ascending sort
- Check funcionality newSearchBuilder module: Check on entity searching: On sort: Generic sort
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On collected and provisioned data: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On collected and provisioned data: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On collected and provisioned data: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: without source data: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: without source data: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: without source data: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: On collected and provisioned data devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: On collected and provisioned data subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: Summary data: On collected and provisioned data subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On without source data: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On without source data: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: On without source data: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on operation searching:
- Check funcionality newSearchBuilder module: Check on operation searching:
- Check funcionality newSearchBuilder module: Check on operation searching:
- Check funcionality newSearchBuilder module: Check on alarm searching: without source data
- Check funcionality newSearchBuilder module: Check on alarm searching: single source data
- Check funcionality newSearchBuilder module: Check on alarm searching: multiple source data
- Check funcionality newSearchBuilder module: Check on bundles searching: bundlesSearchBuilder
public filter(filter: FilterBuilder | object): SearchBuilder source
The search request will have this filter
Params:
| Name | Type | Attribute | Description |
| filter | FilterBuilder | object |
|
Example:
ogapi.subscriptionsSearchBuilder().filter(
ogapi.newFilterBuilder().and(Ex.like('prov.customid', 'SN32'), Ex.neq('entityId', '1124'))
) // Setting FilterBuilder
ogapi.subscriptionsSearchBuilder().filter(
{"and": [{"like": {"entityId": "0000000000000001"}}]}
) // Custom filter
Test:
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter:
- Check funcionality newSearchBuilder module: Check on entity searching: using filterBuilder:
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscribersSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: devicesSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscriptionsSearchBuilder
- Check funcionality newSearchBuilder module: Check on entity searching: with empty filter: subscribersSearchBuilder
public findAllFields(input: *): Promise source
Return a promise which it will contains an array with fields recommended with complete structure
Params:
| Name | Type | Attribute | Description |
| input | * |
public findFieldPath(field: *): Promise source
Return a promise which it will contains an string with the path of a field
Params:
| Name | Type | Attribute | Description |
| field | * |
public findFields(input: *): Promise source
Return a promise which it will contains an array with fields recommended with only identifier
Params:
| Name | Type | Attribute | Description |
| input | * |
public limit(size: number, start: number): SearchBuilder source
Set reponse pagination.
Example:
ogapi.subscribersSearchBuilder().limit(10) // Without offset
ogapi.subscribersSearchBuilder().limit(25,50) //With offset value 50
public removeSortBy(filterField: string): SearchBuilder source
Remove sort param from the search object
Params:
| Name | Type | Attribute | Description |
| filterField | string | This field must be allowed into the specific resource |
Example:
ogapi.subscriptionsSearchBuilder().removeSortBy('prov.customid') // Remove order by prov.customid
ogapi.subscriptionsSearchBuilder().removeSortBy() // Remove all order by parameters
public withTimeout(ms: number): SearchBuilder source
The request will have a specific time out if it will be exceeded then the promise throw an exception
Params:
| Name | Type | Attribute | Description |
| ms | number | timeout in milliseconds |
Example:
ogapi.subscriptionsSearchBuilder().withTimeout(2000)
Test:
- Check funcionality newSearchBuilder module: Check setting timeout Throw error on exceeded timeout
- Check funcionality newSearchBuilder module: Check setting timeout It is all ok when not exceeded timeout
- Check funcionality newSearchBuilder module: Check setting timeout Check default timeout value when it is no setted
- Check funcionality newSearchBuilder module: Check setting timeout withTimeout parameter must be a number