Files
elasticsearch-js/scripts/generate/templates/api_methods.tmpl
Spencer Alger d30cea1db0 Updated the api to include the latest changes, fixed the id of the api-method-index, moved the index out of the
existing menu as to prevent the other options in the menu from being hidden. Added the options of an enum param
to the docs.
2014-01-20 09:25:29 -07:00

65 lines
1.7 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<%= 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
%>