Migrate integrations a-d to generic flowhandler (#111861)

This commit is contained in:
Erik Montnemery 2024-02-29 20:07:14 +01:00 committed by GitHub
parent ba4120d779
commit 6fe28d3764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 841 additions and 758 deletions

View file

@ -9,9 +9,8 @@ from aiohttp.client_exceptions import ClientConnectorError
import nextcord
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_API_TOKEN, CONF_NAME
from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN, URL_PLACEHOLDER
@ -20,16 +19,18 @@ _LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = vol.Schema({vol.Required(CONF_API_TOKEN): str})
class DiscordFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class DiscordFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Discord."""
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
async def async_step_reauth(
self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult:
"""Handle a reauthorization flow request."""
return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> ConfigFlowResult:
"""Confirm reauth dialog."""
errors = {}
@ -52,7 +53,7 @@ class DiscordFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_user(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
) -> ConfigFlowResult:
"""Handle a flow initiated by the user."""
errors = {}