[docs] add body parameter to all methods that accept it

This commit is contained in:
spalger
2016-11-16 12:40:38 -07:00
parent dd8fab9bdc
commit 849c28a8d0
2 changed files with 23 additions and 3 deletions

View File

@ -31,8 +31,8 @@ The default method is `<%= action.spec.method || 'GET' %>` and the usual <<api-c
*Params*
[horizontal]<%
_.each(action.allParams, function (param, paramName) {
var printParam = function (param, paramName) {
// param name
print(`\n\`${paramWithDefault(paramName, param.default)}\`::`)
@ -46,7 +46,23 @@ _.each(action.allParams, function (param, paramName) {
})
print('\n')
}
}); %>
}
_.each(action.allParams, printParam)
if (action.spec.method && action.spec.method !== 'GET') {
var bodyTitle = `${action.spec.needBody ? 'The' : 'An optional'} request body`
var bodyTypeDesc = action.spec.bulkBody
? 'as either an array of objects or new-line delimited JSON objects'
: 'as either JSON or a JSON serializable object'
printParam({
type: action.spec.bulkBody ? 'bulkbody' : 'body',
description: `${bodyTitle}, ${bodyTypeDesc}. See ${action.docUrl}[the elasticsearch docs] for details about what can be specified here.`
}, 'body')
}
%>
link:#[back to top]<%