Class: INRRequest

INRRequest

IdealNet REST Request (INRRequest) class.

Provides a way to process an incoming REST request
in a PubSub manner and return the results to the
caller.


new INRRequest(path, restReq)

Create a request.

Parameters:
Name Type Description
path string

the pubsub message path for the request

restReq Object

the REST request body to parse

Properties
Name Type Description
token string

the token of the client being used to make the request

signature string

the signature of req.payload + private key

group Number

the group number for the location

siteId Number

the location id

payload Object

the actual api body to be used to make the pubsub request (structure varies)

Source:

Members


lmsRedirect

Send message payload that is over the 50k limit to the redirect service and return
the updated payload.

Take the payload and send it via HTTP Post to the redirect service. The redirect service
will return an object that has a boolean "success" property and a string "hash_id" property.
The returned hash_id will be set on a new property called "redirect"
and the payload's "data" property will be cleared. Return a promise that resolves with the
updated payload.

Source:

path

Getter for path

Source:

payload

Getter for payload.

Source:

pubSubIt

Send message via IdealNet PubSub and return the response.

Connect to IdealNet PubSub as a proxy for the REST request,
send the request and wait on the results to return as the
results for the REST request.

Source:

restReq

Getter for client.

Source:

signature

Getter for signature.

Source:

token

Getter for token.

Source:

Methods


publish(client)

Publish to pubsub the data.

Check the payload size, if the size is over 50k bytes then call the lmsRedirect function
to get the redirect hash_id. Send the request as normal if the payload is under 50k bytes.

Parameters:
Name Type Description
client INRClient

The client that has established the connection with pubsub.

Source: