Files
opensearch-pyd/utils/templates/base
T
2020-10-28 13:49:05 -05:00

38 lines
1.4 KiB
Plaintext

@query_params({{ api.query_params|map("tojson")|join(", ")}})
async def {{ api.name }}(self, {% include "func_params" %}):
"""
{% if api.description %}
{{ api.description|replace("\n", " ")|wordwrap(wrapstring="\n ") }}
{% endif %}
{% if api.doc_url %}
`<{{ api.doc_url }}>`_
{% endif %}
{% if api.stability != "stable" %}
.. warning::
This API is **{{ api.stability }}** so may include breaking changes
or be removed in a future version
{% endif %}
{% if api.params|list|length %}
{% for p, info in api.params %}
{% filter wordwrap(72, wrapstring="\n ") %}
:arg {{ p }}: {{ info.description }}{% if info.options %} Valid choices: {{ info.options|join(", ") }}{% endif %}{% if info.default %} Default: {{ info.default }}{% endif %}
{% endfilter %}
{% endfor %}
{% endif %}
"""
{% include "substitutions" %}
{% include "required" %}
{% if api.body.serialize == "bulk" %}
body = _bulk_body(self.transport.serializer, body)
{% endif %}
{% block request %}
return await self.transport.perform_request("{{ api.method }}", {% include "url" %}, params=params, headers=headers{% if api.body %}, body=body{% endif %})
{% endblock %}