Constructor
new IotData()
Constructs a service object. This object has one method for each API operation.
- Source:
Example
Constructing a IotData object
var iotdata = new GG.IotData();
Methods
deleteThingShadow(params, callback)
Call shadow lambda to delete the shadow state.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
||||||
callback |
iotDataCallback | The callback. |
- Source:
getThingShadow(params, callback)
Gets the thing shadow for the specified thing.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
||||||
callback |
iotDataCallback | The callback. |
- Source:
Example
Calling the getThingShadow operation
var params = {
thingName: 'STRING_VALUE' // required
};
iotdata.getThingShadow(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
publish(params, callback)
Publishes a message within Greengrass.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
||||||||||||
callback |
iotDataCallback | The callback. |
- Source:
Example
Calling the publish operation
var params = {
topic: 'STRING_VALUE', // required
payload: new Buffer('...') || 'STRING_VALUE',
queueFullPolicy: 'AllOrError' || 'BestEffort'
};
iotdata.publish(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
updateThingShadow(params, callback)
Updates the thing shadow for the specified thing.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
|||||||||
callback |
iotDataCallback | The callback. |
- Source:
Example
Calling the updateThingShadow operation
var params = {
payload: 'Proper JSON data', // required
thingName: 'STRING_VALUE' // required
};
iotdata.updateThingShadow(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});