new Stream(obj)
A Stream object
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | An object with the Stream properties |
- Source:
Extends
Members
getObject
- Overrides:
- Source:
Methods
exportProperties()
Exposes setter and getter for a class from the `data` field
- Overrides:
- Source:
getClient() → {Client}
Return the client reference
- Overrides:
- Source:
Returns:
client
- Type
- Client
getContainer() → {Raptor}
Return the Raptor instance wrapper
- Overrides:
- Source:
Returns:
container Raptor instance reference
- Type
- Raptor
lastUpdate() → {Promise}
Retieve last updated data from a ServiceObject stream
- Source:
Returns:
Promise callback with result
- Type
- Promise
lastUpdate() → {Promise}
Retieve last updated data from a ServiceObject stream
- Source:
Returns:
Promise callback with result
- Type
- Promise
parseJSON(raw)
Parse a plain object and populate the corresponding fields in the current instance
Parameters:
Name | Type | Description |
---|---|---|
raw |
Object | the json object |
- Overrides:
- Source:
pull(size, from) → {Promise}
Retieve data from a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
size |
int | optional, the number of elements to return |
from |
int | optional, the first value to get from the list for paging |
- Source:
Returns:
Promise callback with result
- Type
- Promise
pull(size, from) → {Promise}
Retieve data from a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
size |
int | optional, the number of elements to return |
from |
int | optional, the first value to get from the list for paging |
- Source:
Returns:
Promise callback with result
- Type
- Promise
push() → {Promise}
Send data to a ServiceObject stream
- Source:
Returns:
Promise callback with result
- Type
- Promise
push() → {Promise}
Send data to a ServiceObject stream
- Source:
Returns:
Promise callback with result
- Type
- Promise
search(params, size, offset) → {Promise}
Search data of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | search params |
size |
int | optional, the number of elements to return |
offset |
int | optional, the first value to get from the list for paging |
- Source:
Returns:
Promise callback with result
- Type
- Promise
search(params, size, offset) → {Promise}
Search data of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | search params |
size |
int | optional, the number of elements to return |
offset |
int | optional, the first value to get from the list for paging |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByBoundingBox(bbox) → {Promise}
Search data of a ServiceObject in a Bounding Box
Parameters:
Name | Type | Description |
---|---|---|
bbox |
Array | An array of 4 elements representing the bounding box, eg ``` [ upperLat, upperLng, bottomLat, bottomLng ] ``` or an Array with 2 elements each one as an object eg ``` [ { latitude: 123, longitude: 321 }, // upper { latitude: 321, longitude: 123 } // bottom ] ``` |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByBoundingBox(bbox) → {Promise}
Search data of a ServiceObject in a Bounding Box
Parameters:
Name | Type | Description |
---|---|---|
bbox |
Array | An array of 4 elements representing the bounding box, eg ``` [ upperLat, upperLng, bottomLat, bottomLng ] ``` or an Array with 2 elements each one as an object eg ``` [ { latitude: 123, longitude: 321 }, // upper { latitude: 321, longitude: 123 } // bottom ] ``` |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByDistance(position, distance, unit) → {Promise}
Search data of a ServiceObject by distance from a point
Parameters:
Name | Type | Description |
---|---|---|
position |
Object | An object representing a geo-position, eg `{ latitude: 123 , longitude: 321 }` |
distance |
Number | The distance value |
unit |
String | Optional unit, default to `km` |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByDistance(position, distance, unit) → {Promise}
Search data of a ServiceObject by distance from a point
Parameters:
Name | Type | Description |
---|---|---|
position |
Object | An object representing a geo-position, eg `{ latitude: 123 , longitude: 321 }` |
distance |
Number | The distance value |
unit |
String | Optional unit, default to `km` |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByNumber(channel, params) → {Promise}
Search data by a numeric value of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
channel |
String | Channel name to search for |
params |
Object | An object with at least one of `from` or `to` properties |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByNumber(channel, params) → {Promise}
Search data by a numeric value of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
channel |
String | Channel name to search for |
params |
Object | An object with at least one of `from` or `to` properties |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByText(channel, string) → {Promise}
Search text for a channel of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
channel |
String | The channel name where to search in |
string |
Number | The string query to search for |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByText(channel, string) → {Promise}
Search text for a channel of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
channel |
String | The channel name where to search in |
string |
Number | The string query to search for |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByTime(params) → {Promise}
Search data by the update time range of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | An object with at least one of `from` or `to` properties |
- Source:
Returns:
Promise callback with result
- Type
- Promise
searchByTime(params) → {Promise}
Search data by the update time range of a ServiceObject stream
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | An object with at least one of `from` or `to` properties |
- Source:
Returns:
Promise callback with result
- Type
- Promise
setContainer(container)
Parameters:
Name | Type | Description |
---|---|---|
container |
Raptor | reference to Raptor instance wrapper |
- Overrides:
- Source:
setServiceObject(object)
Set a reference to the parent object
Parameters:
Name | Type | Description |
---|---|---|
object |
ServiceObject | reference to the parent object |
- Overrides:
- Source:
subscribe() → {Promise}
Create a pubsub subscription for the stream
- Source:
Returns:
A promise for the subscription object creation
- Type
- Promise
subscribe() → {Promise}
Create a pubsub subscription for the stream
- Source:
Returns:
A promise for the subscription object creation
- Type
- Promise
toJSON() → {Object}
Convert the instance to a js object
- Overrides:
- Source:
Returns:
Plain js object
- Type
- Object
toString() → {String}
Return a JSON string of this object
- Overrides:
- Source:
Returns:
json stringified JSON
- Type
- String
unsubscribe(fn) → {Stream}
Remove a subscription for a stream
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Callback to be called when data is received |
- Source:
Returns:
The current stream
- Type
- Stream
unsubscribe(fn) → {Stream}
Remove a subscription for a stream
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Callback to be called when data is received |
- Source:
Returns:
The current stream
- Type
- Stream
validate() → {void}
Validate the object and throw an exception if fails
- Overrides:
- Source:
Returns:
- Type
- void