lib/mbaasRequest/mbaasRequest.js
function _buildAdminMbaasParams(params) {
  log.logger.debug({params: params}, "FH-MBAAS-CLIENT: _buildAdminMbaasParams");
  var basePath;
  basePath = config.addURIParams(constants.ADMIN_API_PATH, params);

  params = params || {};

  var method, resourcePath;

  method = params.method;
  resourcePath = params.resourcePath;

  var mbaasUrl =  params.__mbaasUrl;
  var parsedMbaasUrl = url.parse(mbaasUrl);
  parsedMbaasUrl.pathname = basePath + resourcePath;

  var adminRequestParams = {
    url: parsedMbaasUrl.format(),
    method: method,
    headers: {
      host: parsedMbaasUrl.host,
      'x-fh-service-key': params.servicekey
    },
    fileRequest: params.fileRequest,
    fileUploadRequest: params.fileUploadRequest,
    data: params.data,
    paginate: params.paginate,
    envLabel: params._label
  };

  if (params.username && params.password) {
    adminRequestParams.auth = {
      user: params.username,
      pass: params.password
    };
  }

  log.logger.debug({adminRequestParams: adminRequestParams}, "FH-MBAAS-CLIENT: _buildAdminMbaasParams");
  return adminRequestParams;
}
function _buildAdminMbaasParams(params) {
  log.logger.debug({params: params}, "FH-MBAAS-CLIENT: _buildAdminMbaasParams");
  var basePath;
  basePath = config.addURIParams(constants.ADMIN_API_PATH, params);

  params = params || {};

  var method, resourcePath;

  method = params.method;
  resourcePath = params.resourcePath;

  var mbaasUrl =  params.__mbaasUrl;
  var parsedMbaasUrl = url.parse(mbaasUrl);
  parsedMbaasUrl.pathname = basePath + resourcePath;

  var adminRequestParams = {
    url: parsedMbaasUrl.format(),
    method: method,
    headers: {
      host: parsedMbaasUrl.host,
      'x-fh-service-key': params.servicekey
    },
    fileRequest: params.fileRequest,
    fileUploadRequest: params.fileUploadRequest,
    data: params.data,
    paginate: params.paginate,
    envLabel: params._label
  };

  if (params.username && params.password) {
    adminRequestParams.auth = {
      user: params.username,
      pass: params.password
    };
  }

  log.logger.debug({adminRequestParams: adminRequestParams}, "FH-MBAAS-CLIENT: _buildAdminMbaasParams");
  return adminRequestParams;
}
function _buildAdminMbaasParams ( params ) { log . logger . debug ( { params : params } , "FH-MBAAS-CLIENT: _buildAdminMbaasParams" ) ; var basePath ; basePath = config . addURIParams ( constants . ADMIN_API_PATH , params ) ; params = params || { } ; var method , resourcePath ; method = params . method ; resourcePath = params . resourcePath ; var mbaasUrl = params . __mbaasUrl ; var parsedMbaasUrl = url . parse ( mbaasUrl ) ; parsedMbaasUrl . pathname = basePath + resourcePath ; var adminRequestParams = { url : parsedMbaasUrl . format ( ) , method : method , headers : { host : parsedMbaasUrl . host , 'x-fh-service-key' : params . servicekey } , fileRequest : params . fileRequest , fileUploadRequest : params . fileUploadRequest , data : params . data , paginate : params . paginate , envLabel : params . _label } ; if ( params . username && params . password ) { adminRequestParams . auth = { user : params . username , pass : params . password } ; } log . logger . debug ( { adminRequestParams : adminRequestParams } , "FH-MBAAS-CLIENT: _buildAdminMbaasParams" ) ; return adminRequestParams ; }
Building Request Params For A Call To Administration APIs In An MbaaS
@param params
@returns {{url: *, json: boolean, method: (method|*|string), auth: {user: *, pass: *}, headers: {host: string}, body: *}}
@private
Building Request Params For A Call To Administration APIs In An MbaaS