lib/pushDynamicEntityValues.js
/*
 * Push data to the push request. Uploads add, delete, and modify
 * instructions to the push request's container. Gets the instruction
 * from the specified JSON file, which is hard-coded in the global constant
 * PATCH_DATA_PATH.
 * Returns response from PATCH /api/v1/bots/{botId}/dynamicEntities/{entityId}/pushRequests/{pushRequestId}/values
 *
 * @param botId
 * @param entityId
 * @param pushRequestId
 *
 */
Push data to the push request. Uploads add, delete, and modify
instructions to the push request's container. Gets the instruction
from the specified JSON file, which is hard-coded in the global constant
PATCH_DATA_PATH.


Push data to the push request . Uploads add delete and modify instructions to the push request ' s container . Gets the instruction from the specified JSON file which is hard - coded in the global constant PATCH_DATA_PATH .
async function pushDataToRequest (botId, entityId, pushRequestId) {
  const patchData = require(PATCH_DATA_PATH);
  const body = JSON.stringify(patchData);
  if (DEBUG) { console.log('pushDataToRequest: body: ' + body); };
  const options = {
    host: utils.DOMAIN,
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json'
    },
    path: BASE_PATH +
      '/bots/' +
      encodeURIComponent(botId) +
      '/dynamicEntities/' +
      encodeURIComponent(entityId) +
      '/pushRequests/' +
      encodeURIComponent(pushRequestId) +
      '/values'
  };
  debug('pushDataToRequest: ' + JSON.stringify(options));
  return ociUtils.promisifiedSendRequest(options, body);
}
async function pushDataToRequest ( botId , entityId , pushRequestId ) { const patchData = require ( PATCH_DATA_PATH ) ; const body = JSON . stringify ( patchData ) ; if ( DEBUG ) { console . log ( 'pushDataToRequest: body: ' + body ) ; } ; const options = { host : utils . DOMAIN , method : 'PATCH' , headers : { 'Content-Type' : 'application/json' } , path : BASE_PATH + '/bots/' + encodeURIComponent ( botId ) + '/dynamicEntities/' + encodeURIComponent ( entityId ) + '/pushRequests/' + encodeURIComponent ( pushRequestId ) + '/values' } ; debug ( 'pushDataToRequest: ' + JSON . stringify ( options ) ) ; return ociUtils . promisifiedSendRequest ( options , body ) ; }
Push data to the push request.
Push data to the push request .
// You can require JSON files in Node as if they were packages