Class: ResourceMessage

iotcs.message.Message.ResourceMessage()

Helpers for building resource report messages.

Constructor

new ResourceMessage()

Classes

Type

Methods

(static) buildResourceMessage(resources, endpointName, reportType, rMopt) → {iotcs.message.Message}

Helper method used for building a resource report message to be sent to the server. The resources objects can be generated by using the ResourceMessage.Resource.buildResource method. The reportType must be taken from the ResourceMessage.Type enumeration. If an invalid value is given an exception is thrown. The rM parameter is the reconciliationMark that can be calculated by using the ResourceMessage.getMD5ofList over the array of paths of the resources given as objects. A resource is an object that must have at least 2 properties as strings: path and methods. Also methods must be string that represents a concatenation of valid HTTP methods comma separated.
Parameters:
Name Type Attributes Description
resources Array.<object> The array of resources that are included in the report message resource report message.
endpointName string The endpoint that is giving the resource report.
reportType string The type of the report.
rM string <optional>
The reconciliationMark used by the server to validate the report.
See:
Returns:
The instance of the resource report message to be sent to the server or null if the message could not be created.
Type
iotcs.message.Message

(static) getMD5ofList(stringArray) → {string}

This generates an MD5 hash of an array of strings. This must to be used to generate the reconciliationMark of the resource report message.
Parameters:
Name Type Description
stringArray Array.<string> The array of strings to use to generate the hash.
Returns:
The MD5 hash.
Type
string

Home