new ResourceEnumerator(client, deviceId)
A class that implements a way of getting the custom resources registered by a device and the
possibility of invoking them (V1 implementation).
Parameters:
Name | Type | Description |
---|---|---|
client |
iotcs.enterprise.EnterpriseClient | The enterprise client associated with the application context of the device for which the resources need to be enumerated. |
deviceId |
string | The ID for which the resources are to be enumerated/invoked. |
Methods
(static) close()
Closes the enumerator and will stop any pending resource invocations.
(static) getResources() → {iotcs.enterprise.Pageable}
Return the list of resources that the device associated with the enumerator has registered in the
cloud.
Returns:
A pageable instance with which pages can be requested that
contain resources as items.
(static) invokeResource(resource, options, queryopt, bodyopt, callback)
Invokes the specified resource with defined options, query and payload.
Resources can be retrieved by using the getResources method and from the items property of the
response the resource objects can be extracted.
A resource object must have the following properties:
- methods: An array of methods the resource accepts.
- endpointId: The device ID.
- the self link: This the link that the resource can be accessed with present in the links
array property.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
resource |
object | The resource to be invoked as described. | |
options |
Object | The request options. The headers are optional and method is mandatory. | |
query |
object |
<optional> |
The query for the request as JSON object. |
body |
string |
<optional> |
The payload for the request. |
callback |
function | The callback function that is called when a response arrives. The * whole HTTP response as JSON object is given as parameter to the callback function. If an error occurs or the response is invalid the error object is passed as the second parameter in the callback with the reason in error.message: callback(response, error). |
- See:
-
iotcs.enterprise.ResourceEnumerator#getResources