function parseBody (request, trimFields) {
  var requestBody = request.body ? request.body.toJSON() : {};
  if (!_.isEmpty(requestBody)) {
    switch (requestBody.mode) {
      case 'urlencoded':
        return parseFormData(requestBody, trimFields);
      case 'formdata':
        return parseFormData(requestBody, trimFields);
      case 'raw':
        return `var body = ${requestBody[requestBody.mode]
          .split('\n')
          .map((line) => { return '@"' + line.replace(/"/g, '""') + '"'; })
          .join(' + "\\n" +\n')};\n` +
          `request.AddParameter("${parseContentType(request)}", ` +
          'body,  ParameterType.RequestBody);\n';
      case 'graphql':
        return parseGraphQL(requestBody, trimFields);
        /* istanbul ignore next */
      case 'file':
        return `request.AddParameter("${parseContentType(request)}", ` +
                    '"<file contents here>", ParameterType.RequestBody);\n';
      default:
        return '';
    }
  }
  return '';
}
/**
 * Parses request object and returns csharp-restsharp code snippet for adding request body
 *
 * @param {Object} request - JSON object representing body of request
 * @param {Boolean} trimFields - indicates whether to trim fields of body
 * @returns {String} code snippet of csharp-restsharp parsed from request object
 */
Parses request object and returns csharp-restsharp code snippet for adding request body
@param {Object} request - JSON object representing body of request
@param {Boolean} trimFields - indicates whether to trim fields of body
@returns {String} code snippet of csharp-restsharp parsed from request object
Parses request object and returns csharp - restsharp code snippet for adding request body @param { Object } request - JSON object representing body of request @param { Boolean } trimFields - indicates whether to trim fields of body @returns { String } code snippet of csharp - restsharp parsed from request object
function parseBody (request, trimFields) {
  var requestBody = request.body ? request.body.toJSON() : {};
  if (!_.isEmpty(requestBody)) {
    switch (requestBody.mode) {
      case 'urlencoded':
        return parseFormData(requestBody, trimFields);
      case 'formdata':
        return parseFormData(requestBody, trimFields);
      case 'raw':
        return `var body = ${requestBody[requestBody.mode]
          .split('\n')
          .map((line) => { return '@"' + line.replace(/"/g, '""') + '"'; })
          .join(' + "\\n" +\n')};\n` +
          `request.AddParameter("${parseContentType(request)}", ` +
          'body,  ParameterType.RequestBody);\n';
      case 'graphql':
        return parseGraphQL(requestBody, trimFields);
      case 'file':
        return `request.AddParameter("${parseContentType(request)}", ` +
                    '"<file contents here>", ParameterType.RequestBody);\n';
      default:
        return '';
    }
  }
  return '';
}
function parseBody ( request , trimFields ) { var requestBody = request . body ? request . body . toJSON ( ) : { } ; if ( ! _ . isEmpty ( requestBody ) ) { switch ( requestBody . mode ) { case 'urlencoded' : return parseFormData ( requestBody , trimFields ) ; case 'formdata' : return parseFormData ( requestBody , trimFields ) ; case 'raw' : return ` ${ requestBody [ requestBody . mode ] . split ( '\n' ) . map ( ( line ) => { return '@"' + line . replace ( / " / g , '""' ) + '"' ; } ) . join ( ' + "\\n" +\n' ) } \n ` + ` ${ parseContentType ( request ) } ` + 'body,  ParameterType.RequestBody);\n' ; case 'graphql' : return parseGraphQL ( requestBody , trimFields ) ; case 'file' : return ` ${ parseContentType ( request ) } ` + '"<file contents here>", ParameterType.RequestBody);\n' ; default : return '' ; } } return '' ; }
Parses request object and returns csharp-restsharp code snippet for adding request body
 @param {Object} request - JSON object representing body of request
 @param {Boolean} trimFields - indicates whether to trim fields of body
 @returns {String} code snippet of csharp-restsharp parsed from request object
Parses request object and returns csharp - restsharp code snippet for adding request body @param { Object } request - JSON object representing body of request @param { Boolean } trimFields - indicates whether to trim fields of body @returns { String } code snippet of csharp - restsharp parsed from request object
/* istanbul ignore next */