1 """Config flow for Geocaching."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
9 from geocachingapi.geocachingapi
import GeocachingApi
15 from .const
import DOMAIN, ENVIRONMENT
19 """Config flow to handle Geocaching OAuth2 authentication."""
27 return logging.getLogger(__name__)
30 self, entry_data: Mapping[str, Any]
31 ) -> ConfigFlowResult:
32 """Perform reauth upon an API authentication error."""
36 self, user_input: dict[str, Any] |
None =
None
37 ) -> ConfigFlowResult:
38 """Dialog that informs the user that reauth is required."""
39 if user_input
is None:
44 """Create an oauth config entry or update existing entry for reauth."""
46 environment=ENVIRONMENT,
47 token=data[
"token"][
"access_token"],
50 status = await api.update()
51 if not status.user
or not status.user.username:
55 status.user.username.lower()
57 self.hass.config_entries.async_update_entry(existing_entry, data=data)
58 await self.hass.config_entries.async_reload(existing_entry.entry_id)
ConfigFlowResult async_step_reauth(self, Mapping[str, Any] entry_data)
logging.Logger logger(self)
ConfigFlowResult async_oauth_create_entry(self, dict[str, Any] data)
ConfigFlowResult async_step_reauth_confirm(self, dict[str, Any]|None user_input=None)
ConfigEntry|None async_set_unique_id(self, str|None unique_id=None, *bool raise_on_progress=True)
ConfigFlowResult async_create_entry(self, *str title, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None, Mapping[str, Any]|None options=None)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
ConfigFlowResult async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_create_entry(self, *str|None title=None, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None)
_FlowResultT async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
config_entries.ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)