# {% include 'includes/header.txt' %}

__all__ = [
    'ApiClient',
]

from collections.abc import Awaitable

import typing_extensions as typing
from lapidary.runtime import *

{% for imp in model.client.imports -%}
import {{ imp }}
{% endfor %}

class ApiClient(ClientBase):
    def __init__(
        self,
        *,
        base_url: str{% if model.client.body.init_method.base_url %} = '{{ model.client.body.init_method.base_url }}'{% endif %},
        **kwargs,
    ):
        super().__init__(
            base_url=base_url,
            {% if model.client.body.init_method.security is not none %}security={{ model.client.body.init_method.security }},
            {% endif -%}
            **kwargs,
        )

    async def __aenter__(self) -> 'ApiClient':
        await super().__aenter__()
        return self

    async def __aexit__(self, __exc_type=None, __exc_value=None, __traceback=None) -> typing.Optional[bool]:
        return await super().__aexit__(__exc_type, __exc_value, __traceback)
{% for func in model.client.body.methods %}
{%- include 'includes/client/method_operation.py.jinja' %}
{%- else %}
    pass
{% endfor -%}
