mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fixed #1217: Fixed union subtypes generation inside arrays of elements
This commit is contained in:
parent
0ed62bcadf
commit
21351de335
7 changed files with 183 additions and 19 deletions
|
|
@ -1,10 +1,32 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from ..types import InlineQueryResult, InlineQueryResultsButton
|
||||
from ..types import (
|
||||
InlineQueryResultArticle,
|
||||
InlineQueryResultAudio,
|
||||
InlineQueryResultCachedAudio,
|
||||
InlineQueryResultCachedDocument,
|
||||
InlineQueryResultCachedGif,
|
||||
InlineQueryResultCachedMpeg4Gif,
|
||||
InlineQueryResultCachedPhoto,
|
||||
InlineQueryResultCachedSticker,
|
||||
InlineQueryResultCachedVideo,
|
||||
InlineQueryResultCachedVoice,
|
||||
InlineQueryResultContact,
|
||||
InlineQueryResultDocument,
|
||||
InlineQueryResultGame,
|
||||
InlineQueryResultGif,
|
||||
InlineQueryResultLocation,
|
||||
InlineQueryResultMpeg4Gif,
|
||||
InlineQueryResultPhoto,
|
||||
InlineQueryResultsButton,
|
||||
InlineQueryResultVenue,
|
||||
InlineQueryResultVideo,
|
||||
InlineQueryResultVoice,
|
||||
)
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
|
|
@ -22,7 +44,30 @@ class AnswerInlineQuery(TelegramMethod[bool]):
|
|||
|
||||
inline_query_id: str
|
||||
"""Unique identifier for the answered query"""
|
||||
results: List[InlineQueryResult]
|
||||
results: List[
|
||||
Union[
|
||||
InlineQueryResultCachedAudio,
|
||||
InlineQueryResultCachedDocument,
|
||||
InlineQueryResultCachedGif,
|
||||
InlineQueryResultCachedMpeg4Gif,
|
||||
InlineQueryResultCachedPhoto,
|
||||
InlineQueryResultCachedSticker,
|
||||
InlineQueryResultCachedVideo,
|
||||
InlineQueryResultCachedVoice,
|
||||
InlineQueryResultArticle,
|
||||
InlineQueryResultAudio,
|
||||
InlineQueryResultContact,
|
||||
InlineQueryResultGame,
|
||||
InlineQueryResultDocument,
|
||||
InlineQueryResultGif,
|
||||
InlineQueryResultLocation,
|
||||
InlineQueryResultMpeg4Gif,
|
||||
InlineQueryResultPhoto,
|
||||
InlineQueryResultVenue,
|
||||
InlineQueryResultVideo,
|
||||
InlineQueryResultVoice,
|
||||
]
|
||||
]
|
||||
"""A JSON-serialized array of results for the inline query"""
|
||||
cache_time: Optional[int] = None
|
||||
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from typing import List, Union
|
||||
|
||||
from ..types import PassportElementError
|
||||
from ..types import (
|
||||
PassportElementErrorDataField,
|
||||
PassportElementErrorFile,
|
||||
PassportElementErrorFiles,
|
||||
PassportElementErrorFrontSide,
|
||||
PassportElementErrorReverseSide,
|
||||
PassportElementErrorSelfie,
|
||||
PassportElementErrorTranslationFile,
|
||||
PassportElementErrorTranslationFiles,
|
||||
PassportElementErrorUnspecified,
|
||||
)
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
|
|
@ -19,5 +29,17 @@ class SetPassportDataErrors(TelegramMethod[bool]):
|
|||
|
||||
user_id: int
|
||||
"""User identifier"""
|
||||
errors: List[PassportElementError]
|
||||
errors: List[
|
||||
Union[
|
||||
PassportElementErrorDataField,
|
||||
PassportElementErrorFrontSide,
|
||||
PassportElementErrorReverseSide,
|
||||
PassportElementErrorSelfie,
|
||||
PassportElementErrorFile,
|
||||
PassportElementErrorFiles,
|
||||
PassportElementErrorTranslationFile,
|
||||
PassportElementErrorTranslationFiles,
|
||||
PassportElementErrorUnspecified,
|
||||
]
|
||||
]
|
||||
"""A JSON-serialized array describing the errors"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue