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 %}
2023-06-27 11:56:55 -07:00
2019-12-22 15:15:00 +01:00
{% if api.doc_url %}
2020-10-20 12:07:41 -05:00
2019-12-22 15:15:00 +01:00
`<{{ api.doc_url }}>`_
{% endif %}
2020-10-28 13:49:05 -05:00
{% if api.stability != "stable" %}
.. warning::
This API is **{{ api.stability }}** so may include breaking changes
or be removed in a future version
{% 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 ") %}
2023-10-03 07:43:05 -07:00
:arg {{ p }}{% if info.deprecated %} (Deprecated: {{ info['deprecation_message'][:-1] }}){% endif %}: {{ info.description }}{% if info.options %} Valid choices: {{ info.options|join(", ") }}{% endif %}
{% if info.default is defined %}{% if info.default is not none %}{% if info.default is sameas(false) %} (default: false){% else %} (default: {{ info.default }}){% endif %}{% endif %}{% endif %}
2019-12-22 15:15:00 +01:00
{% endfilter %}
{% endfor %}
{% endif %}
"""
2023-10-09 13:47:26 -07:00
{% if api.deprecation_message %}
from warnings import warn
warn("Deprecated: {{ api.deprecation_message }}")
{% endif %}
2019-12-22 15:15:00 +01:00
{% include "substitutions" %}
{% include "required" %}
2019-12-22 15:35:00 +01:00
{% if api.body.serialize == "bulk" %}
2020-02-21 12:12:27 -06:00
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 %}