Files
elasticsearch-js/scripts/generate/templates/api_methods.tmpl
2015-05-26 07:16:12 -07:00

58 lines
1.6 KiB
Cheetah

[[api-reference<%= branchSuffix %>]]
== <%= branch %> API
<% if (branchIsDefault) { %>
NOTE: This is currently the default API, but in upcomming versions that will change. We recommend setting the `apiVersion` config param when you instantiate your client to make sure that the API does not change unexpectedly.
<% } else { %>
NOTE: At this time, you must opt into the <%= branch %> API by setting the `apiVersion` config parameter.
<% }
// method index%>
[[js-api-method-index<%= branchSuffix %>]]<%
actions = _.sortBy(actions, 'namespace');
_.each(actions, function (action) {
action.index = 'api-' + action.name.toLowerCase().replace(/[^\w]+/g, '-') + branchSuffix; %>
* <%= '<<' + action.index + ',' + action.name + '>>' %><%
})
_.each(actions, function (action) {
%>
[[<%= action.index %>]]
=== `<%= action.name %>`
[source,js]
--------
client.<%= action.name %>([params, [callback]])
--------
<%= description(action.name) %>
The default method is `<%= action.spec.method || 'GET' %>` and the usual <<api-conventions,params and return values>> apply. See <%= action.docUrl %>[the elasticsearch docs] for more about this method.
<%= examples(action.name) %>
<% if (_.size(action.allParams)) { %>
*Params*
[horizontal]<%
_.each(action.allParams, function (param, paramName) { %>
`<%= paramWithDefault(paramName, param.default) %>`::
`<%= paramType(param.type) %>` -- <%= joinParagraphs(param.description || '', 4) %><%
if (param.type === 'enum') {%>
Options:::<%
_.each(param.options, function (opt) {%>
* `"<%= opt %>"`<%
});%>
<%
} // endif enum
}); // endeach param %>
link:#[back to top]<%
} // endif size allParams
}); // endeach
%>