Debian Codegraph @

hass_nabucasa/account_api.py

raw
1 """Manage account API."""
2
3 from __future__ import annotations
4
5 from typing import TypedDict
6
7 from .api import ApiBase, CloudApiError, api_exception_handler
8
9
10 class AccountApiError(CloudApiError):
11 """Exception raised when handling account API."""
12
13
14 class AccountServicesDetails(TypedDict):
15 """Details of the services."""
16
17 alexa: AccountServiceDetails
18 google_home: AccountServiceDetails
19 remote_access: AccountServiceDetails
20 stt: AccountServiceDetails
21 storage: AccountStorageServiceDetails
22 tts: AccountServiceDetails
23 webhooks: AccountServiceDetails
24 webrtc: AccountServiceDetails
25
26
27 class AccountServiceDetails(TypedDict):
28 """Details of a service."""
29
30 available: bool
31
32
33 class AccountStorageServiceDetails(AccountServiceDetails):
34 """Details of a service."""
35
36 limit_bytes: int
37
38
39 class AccountApi(ApiBase):
40 """Class to help communicate with the instance API."""
41
42 @api_exception_handler(AccountApiError)
43 async def services(self) -> AccountServicesDetails:
44 """Get the services details."""
45 details: AccountServicesDetails = await self._call_cloud_api(
46 action="account_services",
47 )
48 return details