Files
opensearch-pyd/utils/templates/base
T

31 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-12-22 15:15:00 +01:00
@query_params({{ api.query_params|map("tojson")|join(", ")}})
2020-05-15 09:36:47 -05:00
async def {{ api.name }}(self, {% include "func_params" %}):
2019-12-22 15:15:00 +01:00
"""
{% if api.description %}
{{ api.description|replace("\n", " ")|wordwrap(wrapstring="\n ") }}
{% endif %}
{% if api.doc_url %}
2019-12-22 15:15:00 +01:00
`<{{ api.doc_url }}>`_
{% endif %}
2020-04-03 12:52:11 -05:00
{% if api.params|list|length %}
2019-12-22 15:15:00 +01:00
{% for p, info in api.params %}
{% filter wordwrap(72, wrapstring="\n ") %}
2020-07-29 15:51:19 -05:00
:arg {{ p }}: {{ info.description }}{% if info.options %} Valid choices: {{ info.options|join(", ") }}{% endif %}{% if info.default %} Default: {{ info.default }}{% endif %}
2019-12-22 15:15:00 +01:00
{% endfilter %}
{% endfor %}
{% endif %}
"""
{% include "substitutions" %}
{% include "required" %}
2019-12-22 15:35:00 +01:00
{% if api.body.serialize == "bulk" %}
body = _bulk_body(self.transport.serializer, body)
2019-12-22 15:15:00 +01:00
{% endif %}
{% block request %}
2020-05-15 09:36:47 -05:00
return await self.transport.perform_request("{{ api.method }}", {% include "url" %}, params=params, headers=headers{% if api.body %}, body=body{% endif %})
2019-12-22 15:15:00 +01:00
{% endblock %}