Module: NanoMemoTools/server

NanoMemoTools.server module
Source:

Methods

(async, inner) getMemos(hashes, serveropt, endpointopt) → {Promise}

This function gathers a memo's data from the server
Parameters:
Name Type Attributes Default Description
hashes array array of 64-hex hash that represents a Nano Block
server string <optional>
SERVER server to POST
endpoint string <optional>
/api/memo/blocks/ endpoint of POST request
Source:
Returns:
Promise object represents array of Memo objectsthe memo object
Type
Promise

(async, inner) getUserData(api_keyopt, api_secretopt, endpointopt) → {Promise}

This function gathers user data from the server
Parameters:
Name Type Attributes Default Description
api_key string <optional>
user public api key; if undefined uses IP rate limiting
api_secret string <optional>
user private secret key; if undefined uses IP rate limiting
endpoint string <optional>
/api/user/ endpoint of POST request
Source:
Returns:
Promise object represents the user data as an object
Type
Promise

(async, inner) saveMemo(memo, api_key, api_secret, serveropt, endpointopt) → {Promise}

This function saves a memo to the server
Parameters:
Name Type Attributes Default Description
memo Memo.Memo memo data to be saved to the server
api_key string public api key
api_secret string private api key
server string <optional>
SERVER server to POST
endpoint string <optional>
/api/memo/new/ endpoint of POST request
Source:
Returns:
Promise object represents the memo object
Type
Promise

(async, inner) websocketSubscribe(onmessage) → {websocket}

This function subscribes to a NanoMemo websocket that will send a message for each new memo that is saved
Parameters:
Name Type Description
onmessage function function to call with newly received memo data
Source:
Returns:
websocket object
Type
websocket

(async, inner) websocketUnsubscribe()

This function unsubscribes to a NanoMemo websocket that was receiving new memos
Source:
Returns:
undefined