1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
import aiohttp
from typing import Any, Dict
from tessie_api.literals import MapStyle
from .tessie_wrapper import tessieRequest
async def get_state(
session: aiohttp.ClientSession, vin: str, api_key: str, use_cache: bool = True
) -> Dict[str, Any]:
return await tessieRequest(
session,
"GET",
f"/{vin}/state",
api_key,
params={"use_cache": str(use_cache).lower()},
)
async def get_state_of_all_vehicles(
session: aiohttp.ClientSession, api_key: str, only_active: bool = True
) -> Dict[str, Any]:
return await tessieRequest(
session,
"GET",
"/vehicles",
api_key,
params={"only_active": str(only_active).lower()},
)
async def get_location(
session: aiohttp.ClientSession, vin: str, api_key: str
) -> Dict[str, Any]:
return await tessieRequest(session, "GET", f"/{vin}/location", api_key)
async def get_weather(
session: aiohttp.ClientSession, vin: str, api_key: str
) -> Dict[str, Any]:
return await tessieRequest(session, "GET", f"/{vin}/weather", api_key)
async def get_map(
session: aiohttp.ClientSession,
vin: str,
api_key: str,
width: int = 300,
height: int = 300,
zoom: int = 13,
marker_size: int = 75,
style: MapStyle = "light",
) -> Dict[str, Any]:
return await tessieRequest(
session,
"GET",
f"/{vin}/map",
api_key,
params={
"width": width,
"heigth": height,
"zoom": zoom,
"marker_size": marker_size,
"style": style,
},
)
|