Add Bot API parser and code-generator

This commit is contained in:
Alex RootJunior 2019-06-30 22:50:51 +03:00
parent 5e9d4e55d9
commit af2573dbee
15 changed files with 3242 additions and 1 deletions

View file

@ -0,0 +1,12 @@
class {{ entity.python_name }}(pydantic.BaseModel):
"""
{{ entity.description|indent(width=4) }}
Source: https://core.telegram.org/bots/api#{{ entity.anchor }}
"""
{% for annotation in entity.annotations %}
{{ annotation.python_argument }}
"""{{ annotation.description|indent(width=4) }}"""
{% else %}
pass
{% endfor %}

View file

@ -0,0 +1,20 @@
"""
!!! DO NOT EDIT THIS FILE !!!
This file is autogenerated from Docs of Telegram Bot API at {{ timestamp }}
"""
import typing
import pydantic
from aiogram import types
__all__ = [
{% for group in groups %}{% for entity in group.childs %}{% if entity.is_type %}
"{{ entity.python_name }}",
{% endif %}{% endfor %}{% endfor %}
]
{% for group in groups %}
{% include 'types_group.py.jinja2' %}
{% endfor %}

View file

@ -0,0 +1,10 @@
# %% Region: '{{ group.title }}'
"""{% if group.description %}
{{ group.description }}
{% endif %}
link: https://core.telegram.org/bots/api#{{ group.anchor }}
"""
{% for entity in group.childs %}{% if entity.is_type %}
{% include 'type.py.jinja2' %}
{% endif %}{% endfor %}
# %% End of region '{{ group.title }}'