Files
elasticsearch-js/scripts/generate/templates/api_methods.tmpl

58 lines
1.5 KiB
Cheetah

[[api-reference<%= branchSuffix %>]]<%
if ( branch === 'master' ) {%>
== 1.0 API
NOTE: At this time, you must opt into the 1.0 API by setting the `apiVerion` config parameter.
<%
} else {%>
== 0.90 API
NOTE: This is currently the default API, but with the upcoming release of Elasticsearch 1.0 that will change. We recommend setting the `apiVersion` config param when you instantiate your client to make sure that the API does not change when the default does.
<%
}
// method index%>
[[js-api-method-index]]<%
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) %><%
}); // endeach %>
link:#[back to top]<%
} // endif
}); // endeach
%>